Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install of --git and --path dependencies not working on Windows 10 #1134

Closed
3 tasks done
alex-lechner opened this issue May 29, 2019 · 4 comments
Closed
3 tasks done

Comments

@alex-lechner
Copy link

alex-lechner commented May 29, 2019

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10
  • Poetry version: Poetry 0.12.16
  • pyproject.toml:
[tool.poetry.dependencies]
python = "^3.7"
my_entities = {git = "https://myprivaterepo.com/my-entities.git"}

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Issue

Recently, I have started using Poetry for a project in different "services" (on Windows 10 as a local machine).

Installing git dependencies

In my first "service" - just a python package which can be installed in other projects or services - I have created a python package which has the following folder structure:

my-entities <!-- root folder -->
│
└─dist
│   └─my_entities-1.0.0-py3-none-any.whl
│   └─my_entities-1.0.0.tar.gz
│   
└─src
│   └─json
│   └─typescript
│   └─py
│       │   package_one
│       │   package_two
│       │   __init__.py
│   
│ pyproject.toml

The pyproject.toml looks like this:

[tool.poetry]
name = "my-entities"
version = "1.0.0"
description = "Some description."
packages = [
    { include = "py/**/*.py", from="src"}
]

[tool.poetry.dependencies]
python = "^3.7"
pydantic = "^0.26.0"
numpy = "^1.16.3"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

In my second service, I want to import the my-entities package but it does not seem to work.

I added the my-entities package by executing poetry add my_entities --git https://myprivaterepo.com/my-entities.git

My questions are:

  1. The folder name is my-entities but python does not allow the import of packages with a dash. If I clone the package with poetry add my-entities --git https://myprivaterepo.com/my-entities.git (with a dash in the name) do I need to import the package as my_entities?
  2. If I import my package with import my_entities I get an error ModuleNotFoundError: No module named 'my_entities'. What is the proper way to clone a private git repository where the python code was packaged with poetry and saved into the dist-folder of the repository?
  3. When I execute poetry run pip freeze a message at the top of the packages list appears Could not find setup.py for directory c:\users\user\appdata\local\pypoetry\cache\virtualenvs\my-project-py3.7\src\my-entities\src (tried all parent directories). Why does the error appear? My pip version is pip 19.0.3

Note: I've already looked at #49, #177, #673, #184 and #321 but they did not solve my problem.

Installing path dependencies

Because I work on a Windows machine libraries like Shapely, Fiona, geopandas, and so on can't be installed with pip. Until I switch my OS (or the library owners start to care about Windows users lol) I need to download the wheels from here.

Let's take the wonderful Fiona package as an example. I have downloaded the wheel package and when I execute poetry add Fiona --path E:/User/Downloads/Fiona-1.8.6-cp37-cp37m-win_amd64.whl -vvv I get the following error:

[RuntimeError]
The dependency name for fiona does not match the actual package's name: Fion
a

Exception trace:
 C:\Users\User\.poetry\lib\poetry\_vendor\py3.7\cleo\application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 C:\Users\User\.poetry\lib\poetry\console\application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 C:\Users\User\.poetry\lib\poetry\_vendor\py3.7\cleo\application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 C:\Users\User\.poetry\lib\poetry\console\commands\command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 C:\Users\User\.poetry\lib\poetry\_vendor\py3.7\cleo\commands\base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 C:\Users\User\.poetry\lib\poetry\_vendor\py3.7\cleo\commands\command.py in execute() at line 107
   return self.handle()
 C:\Users\User\.poetry\lib\poetry\console\commands\add.py in handle() at line 139
   status = installer.run()
 C:\Users\User\.poetry\lib\poetry\installation\installer.py in run() at line 73
   self._do_install(local_repo)
 C:\Users\User\.poetry\lib\poetry\installation\installer.py in _do_install() at line 165
   ops = solver.solve(use_latest=self._whitelist)
 C:\Users\User\.poetry\lib\poetry\puzzle\solver.py in solve() at line 38
   packages, depths = self._solve(use_latest=use_latest)
 C:\Users\User\.poetry\lib\poetry\puzzle\solver.py in _solve() at line 171
   self._package, self._provider, locked=locked, use_latest=use_latest
 C:\Users\User\.poetry\lib\poetry\mixology\__init__.py in resolve_version() at line 7
   return solver.solve()
 C:\Users\User\.poetry\lib\poetry\mixology\version_solver.py in solve() at line 79
   next = self._choose_package_version()
 C:\Users\User\.poetry\lib\poetry\mixology\version_solver.py in _choose_package_version() at line 354
   packages = self._provider.search_for(dependency)
 C:\Users\User\.poetry\lib\poetry\puzzle\provider.py in search_for() at line 135
   packages = self.search_for_file(dependency)
 C:\Users\User\.poetry\lib\poetry\puzzle\provider.py in search_for_file() at line 213
   dependency.name, meta.name

I have also tried executing the command poetry add fiona --path E:/User/Downloads/Fiona-1.8.6-cp37-cp37m-win_amd64.whl -vvv with a lowercase f in fiona but I get the same error.

My questions:
4. Is there a way to make poetry use conda instead of pip? Because the package can be installed with conda.
5. How can I ensure in pyproject.toml that Windows users need to download the wheel distributions and other users (Mac, Linux, etc.) can install it the "normal" way with pip? Is there a way to give explicit commands or set flags for different operating systems?

For example something like:

[tool.poetry.dependencies]
Fiona = {version = "^1.8.6", os=["!windows"]}
Fiona = {path = "E:/User/Downloads/Fiona-1.8.6-cp37-cp37m-win_amd64.whl", ifNotExist="Please download the package from https://www.lfd.uci.edu/~gohlke/pythonlibs/#Fiona" os=["windows"]}
@stale
Copy link

stale bot commented Nov 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 13, 2019
@alex-lechner
Copy link
Author

Still not resolved.

@stale stale bot removed the stale label Nov 13, 2019
@sdispater
Copy link
Member

@alex-lechner Can you try with the latest beta release of the 1.0.0 version?

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants