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

poetry install installs the project as a dependency of itself? #800

Closed
2 tasks done
taljaards opened this issue Jan 15, 2019 · 21 comments
Closed
2 tasks done

poetry install installs the project as a dependency of itself? #800

taljaards opened this issue Jan 15, 2019 · 21 comments

Comments

@taljaards
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Question

TL;DR: Is it expected behaviour when doing poetry install for the project to install itself as a dependency of itself?

I have started a new project using poetry init and followed up by poetry adding all my dependencies. I then pushed, and then cloned the git repo to another PC.

After the clone, I opened the new folder and did poetry install in that folder. That created the new virtual environment, as expected, but it also seems as if it installed the project as a dependency of itself. Please see the screenshot below. This is also evident in the new egg-info folder that was created. I expected the installations to stop at the last package (requests).
screenshot

I did not expect that behaviour and would like to confirm if that is the intention of poetry install.
You can find my project files here:

@KyleKing
Copy link
Contributor

That is the expected behavior and I also have the same issue using Poetry as a virtualenv manager. sdispater plans to add a feature in ^1.0.0 to disable this (#730 (comment))

There is an open PR to pass an option to disable installing the project pending merge: #757

@taljaards
Copy link
Author

Thanks, Kyle.
To make sure I use both features correctly and efficiently, why would one want to install the project package itself, and why not?

I read on your linked comment that installing itself too ensures that "new elements like entrypoints are properly installed". Does this mean that on my first PC, where I created the project from scratch, that these were already installed when I did poetry init + the first poetry add?

@KyleKing
Copy link
Contributor

I'm not sure, I imagine it may be used when developing Python modules where you may want the environment to have the package for running tests rather than using relative imports from the test directory

I only linked the comment to reference that sdispater mentioned not installing the project within the project would be a supported feature.

I'm pretty sure poetry install is the only command that uses the python -e command. poetry init is just file creation and poetry add is really only a wrapper (and version lock manager) for python -m pip install

@KyleKing
Copy link
Contributor

KyleKing commented Jan 17, 2019

Update: this is what it's used for 😅 #34 (comment)

The python -e command was added in poetry develop then merged into python install to allow this type of local development. It doesn't impact poetry add or other poetry commands. It will likely become optional in the ^1.0.0

@skorokithakis
Copy link

I would also like to vote for an option to not install the project. Furthermore, the documentation is currently inaccurate, as poetry list says about install: "Installs the project dependencies."

I, and I think most other people, understand this to mean that it does not install the project itself.

My use case for this is that I mainly develop Django applications, and whenever I run poetry install I only want the dependencies to be installed, and not the project itself (as that does not make sense for my use case).

@max-wittig
Copy link

max-wittig commented Feb 6, 2019

Poetry is not ready for corporate environments of this time, because of this issue.

This is really required, especially if there is no internet connection available but only a PyPI mirror.

(At least it should also pass the PyPI mirror defined in the toml file to pip)

[[tool.poetry.source]]
name = "artifactory"
url = "https://some-artifactory/artifactory/api/pypi/pypi-all/simple/"
poetry install -n
Creating virtualenv inspector-py3.7 in /root/.cache/pypoetry/virtualenvs
Installing dependencies from lock file


Package operations: 17 installs, 0 updates, 0 removals

  - Installing certifi (2018.11.29)
  - Installing chardet (3.0.4)
  - Installing idna (2.8)
  - Installing urllib3 (1.24.1)
  - Installing appdirs (1.4.3)
  - Installing attrs (18.2.0)
  - Installing click (7.0)
  - Installing markupsafe (1.1.0)
  - Installing requests (2.21.0)
  - Installing six (1.12.0)
  - Installing toml (0.10.0)
  - Installing black (18.9b0)
  - Installing jinja2 (2.10)
  - Installing python-dateutil (2.8.0)
  - Installing python-gitlab (1.7.0)
  - Installing pyyaml (3.13)
  - Installing tenacity (5.0.3)
  - Installing inspector (0.1.0)
/usr/local/lib/python3.7/site-packages/poetry/vcs/__init__.py:19: RuntimeWarning: git executable could not be found
  "git executable could not be found", category=RuntimeWarning
                                                                                
[EnvCommandError]                                                
Command ['/root/.cache/pypoetry/virtualenvs/inspector-py3.7/bin/pip', 'insta  
ll', '-e', '/builds/code-ops/inner-source-inspector', '--no-deps'] errored w  
ith the following output:                                                     
Obtaining file:///builds/code-ops/inner-source-inspector                      
  Installing build dependencies: started                                      
  Installing build dependencies: still running...                             
  Installing build dependencies: still running...                             
  Installing build dependencies: still running...                             
  Installing build dependencies: still running...                             
  Installing build dependencies: still running...                             
  Installing build dependencies: still running...                             
  Installing build dependencies: finished with status 'error'                 
  Complete output from command /root/.cache/pypoetry/virtualenvs/inspector-p  
y3.7/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pi  
p-build-env-tfd8pos2 --no-warn-script-location --no-binary :none: --only-bin  
ary :none: -i https://pypi.org/simple -- poetry>=0.12:                        
  Collecting poetry>=0.12                                                     
    Retrying

@simoncoulton
Copy link

simoncoulton commented Feb 21, 2019

This is also causing an issue with forked repositories. I'm currently using django-tenant-schemas, and when the setup.py file is created it is adding:

install_requires = \
['django-tenant-schemas',

This is defined in pyproject.toml as referencing a forked Github repo (which contains some bug fixes, it's not yet merged), however in setup.py it's falling back to the version that's on pypi.

My current workaround is to have an additional RUN command in my Docker container calling Pip directly...

EDIT: Another workaround is to have the dependency installed as a dev dependency, however then I can't take advantage of --no-dev.

@skorokithakis
Copy link

Poetry is not ready for corporate environments of this time, because of this issue.

I will agree with this. I wanted to move our projects to Poetry but this issue is a blocker, as it creates problems with our caches (the package is already in there and the runners get confused). It's too bad, because I love Poetry otherwise, but we had to go with pip-compile in the end.

Could this please be fixed? I'd very much like to use Poetry to deploy our apps.

@brycedrennan
Copy link
Contributor

brycedrennan commented Mar 6, 2019

My corporate environment is also blocked by this issue. I patched a version based on #757. I left a comment with the necessary modifications. Wheel version here

In my dockerfile I'm using:
pip install https://github.com/BlueOwlDev/poetry/releases/download/1.0.0a44/poetry-1.0.0a44-py2.py3-none-any.whl

@jnoortheen
Copy link

jnoortheen commented Apr 12, 2019

I solved the issue by changing the project-name in pyproject.toml to be something different than the directory name itself.

Poetry: 0.12.11

@denizdogan
Copy link

What @jnoortheen suggested seems to work for me too, but it's not exactly clear to me why? Surely this behavior is a bug?

@drunkwcodes
Copy link

The option has been already merged into develop branch: #979

But I think the name of the option should rename to something like --no-cwd because of the meaning of root is special in POSIX filesystem.

@skorokithakis
Copy link

@drunkwcodes Do you know if this has been released in any version? I can't find it in 0.12.12...

@skorokithakis
Copy link

@sdispater Do you know when this might be released? I am about to introduce poetry at our company and I think this behavior would hinder adoption, maybe I can wait a bit if the feature is coming soon.

@skorokithakis
Copy link

skorokithakis commented May 27, 2019

This seems to be in 1.0.0a3. However, I'm not sure when that will be released and there's no word from a maintainer. Hopefully release will happen soon, but the lack of an update here is frustrating.

@brycedrennan brycedrennan mentioned this issue Jul 4, 2019
2 tasks
@sirmarcel
Copy link

Hello everyone! Any news on this?

@sdispater
Copy link
Member

The feature is present in the 1.0.0 prereleases, so if it's important to you you can use them. It will be available officially in the 1.0.0 stable release.

@justinmayer
Copy link
Contributor

Many thanks, Sébastien. For posterity, this is currently documented in the development branch in docs > CLI > install (at bottom) and invoked via:

poetry install --no-root

@mwchase
Copy link

mwchase commented Mar 20, 2020

Pytest has a bunch of dependencies, some of which have their own dependencies.

Copy link

github-actions bot commented Mar 3, 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 3, 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