You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We cannot run pip install -e . because there is no setup.py. What would be the way to achieve this using poetry?
Reacted by Frank Sachsenheim, Daniel Shaulov, Mitch Coote, Tin Tvrtković, Nicolas K., Jared Mackey, Guillaume Binet, Victor-Nicolae Savu, Oliver Berger, Baptiste Darthenay and 114 more
No, this is not possible right now. And I don't think I will add an equivalent since it always seemed like a hack to me. But I might be wrong.
Why do you need pip install -e .? So I can see if there is a "poetry way" to do what you want.
Reacted by Etienne Napoleone, boreBoar and Felipe S. S. Schneider
Reacted by Michel Albert, Yevgnen, Rob Voigt, Romain, Petter Strandmark, tsiq-alberto, Johannes Gontrum, Shoma Okamoto, George Walker, Maksim Kurnikov and 122 more
Reacted by Sorin Sbarnea, Bruno Rocha, rrrealman, Aykut Yilmaz, Mel Massadian, Stephen Bunn, Rafal Skolasinski, Leoni Mota Loris, Evgeny Pogrebnyak, Jamie Harris and 5 more
I often depend on some local packages, for which I want to be able to change some code and not have to reinstall.
Reacted by Yevgnen, Rob Voigt, Jeff Thompson, Daniel Burkhardt Cerigo, Shoma Okamoto, Robin Linacre, Rodrigo Silva, Ryan Butler, Ülgen Sarıkavak, Damien Garros and 79 more
The thing is poetry is a dependency/project management tool and is not intended for such use cases.
However, if you really want to to this, you can build your project poetry build and take the setup.py file from the generated tarball and then you should be able to do pip install -e .
Reacted by Gus Dunn, Harris Tzovanakis, Daniel Severo, György Kiss, Chun.Zheng, Carlos Pereira Atencio, Yevgnen, Rob Voigt, vxdcxw, Churkin Oleg and 176 more
Ah sorry, with local I mostly meant "developing local packages". I do believe poetry is also for helping with that? It sounds like barely any work to automate that part and create e.g. the poetry develop command.
Well, poetry can help you develop local packages by orchestrating your dependencies, sure. But it is not meant to support the use case of having only local packages that depend on each other since this is not the best practice that poetry tries to endorse.
However, if you are willing to make a Pull Request, I would gladly take a look at it.
Reacted by Gus Dunn, Hans Lellelid, Micah, Daniel Severo, György Kiss, gnovikov, Michel Albert, Yevgnen, Aaron Wright, Kevin Nguyen and 101 more
I might be off the mark here, but in my experience, I usually use pip install -e . in order to allow my acceptance tests to see the python project I am testing. Is that what we are talking about here?
Reacted by Andrew Meyer, Xander Johnson, Gus Dunn, Stefane Fermigier, Marlon, Daniel Severo, Michel Albert, Carlos Pereira Atencio, Jan Koch, Yevgnen and 70 more
I don't see why you would need pip install -e . for your tests to work. If you are inside a virtualenv your dependencies should be picked up by your tests.
In poetry that would be:
poetry install # install your dependencies
poetry run pytest tests/
Reacted by b-long, Christian Long, Fabian, Connor Ferster, Ry Whittington and Darren Weber
Reacted by Jari, Pietro Fumiani, Malcolm Greaves, Leoni Mota Loris, Johannes Kvamme, Lucas Saldyt, Josip Delić, diffnull, Renan Costa, Mikko Ohtamaa and 19 more
I'm not sure, but when you share a module in git, with other dev members, it's nice when it is updated automatically on pull. Or is this automatically managed in pycharm or something? I use emacs without virtualenvs but just simply different python versions.
I guess this is a bit of a style question, but I like to build a wheel for local packages and use pip to install them into my venv. Is that the workflow that is intended by poetry?
@winni2k Not at the moment, no. For now, poetry assumes each dependency is located in a remote repository (PyPI or a private one) or is a VCS dependency, and does not support local packages.
That might change in the future, however but I can't give you an ETA.
I am trying first to support the most common use cases, like installing from PyPI before diving into more specific workflow, especially if they are not the recommended way of managing packages.
Reacted by Felix Andreas, Andrew Hautau and Connor Ferster
Reacted by Nambi Sankaran, Jari, Mike Nerone, Leoni Mota Loris, egabrum, Martín Gaitán, Pablo Aguiar, nbro10 and Fridtjof Petersen
It now also does not allow me to use it in the interactive interpreter :/
I tried using poetry build, then copy out the setup.py to the root level but that doesn't work. I'm very disappointed :(
Until this becomes important, I wish there'd be a nice hack. I'm wondering though how do you develop - how do you avoid having to constantly reinstall?
Reacted by Gus Dunn, Sovetnikov, Aaron Wright, Daniel Burkhardt Cerigo, Antti Kaihola, rrrealman, Alan Rominger, Malcolm Greaves, Conner Cowling, Brian Ealdwine and 7 more
@kootenpv I just tested and copying the setup.py file works.
I don't know how you develop, but I never need pip install -e .. I either upload my packages to PyPI or a private index, or I install from a git repository.
Reacted by Aaron Wright, Petter Strandmark, Daniel Burkhardt Cerigo, tsiq-alberto, Alberto Montañola, 2xS, Donald J. Welch, Al Johri, Gonçalo Carito, Ben Simpson and 116 more
Reacted by kernc, Ali Asgari, Nathan, Jakub Bahyl and Dmitry Kazakov
Reacted by Brian Ealdwine, Iwan Aucamp, Nicolas Caniart, Gitsoft and reputed-victor
I don't know how you develop, but I never need pip install -e .. I either upload my packages to PyPI or a private index, or I install from a git repository
Ugh, that is not developing, that is installing a finished package.
These are roughly equivalent, in your src dir:
pip install -e .
python setup.py develop
It's called "installing a package in development mode". They are the starting point of beginning development. If you are not familiar with that, then I honestly do not understand how you do development.
I know two ways of doing development without it:
export PYTHONPATH=
or in your code:
import sys
sys.path.append(....)
Are you recommending this? (I hope not)
Reacted by Étienne BERSAC, Guillaume Binet, Nick Humrich, Austen Cameron, Sylvain Hellegouarch, Daniel Miranda, György Kiss, gnovikov, Kostis Anagnostopoulos, Hans Lellelid and 177 more
Reacted by Arjun, Matthieu Rigal, Santiago Fraire Willemoes, Olly, Samuel Meuli, Allan Lei, Tim Blazina, Jason Tyler, Frankie Robertson, Chun.Zheng and 17 more
Reacted by Frank Sachsenheim, Constantine Molchanov, Paweł Adamczak, Guillaume Binet, Michael Floering, Micah, Sovetnikov, tsiq-alberto, Qiushi Pan, Brian Ealdwine and 4 more
Reacted by gnovikov, Hans Lellelid, Yevgnen, Pierre Rust, Petter Strandmark, Rodrigo Silva, Bruno Rocha, Tuk Bredsdorff, Jari, mhnatiuk and 26 more
No, I don't modify sys.path(). And please don't be condescending.
So, if I develop a library (or an application for that matter) I put myself in my project directory. At this point I have access to my module: I can import it in my tests to test it.
You can test this yourself: clone the poetry repository place yourself in it install the dependencies with poetry install and execute poetry run pytest tests/ and everything will work. You do not need pip install -e .
If you need it in another project, and that is why you install it in develop mode, the you have dependencies between project and in this case I recommend to use a private index and release preversions or installing from git repository and updating when needed.
Reacted by Ralf Farkas, Michael Floering, Frankie Robertson, Nathaniel Knight, Rex, Qiushi Pan, Else, Someone, Felix Andreas, Owen Solberg, Šarūnas Nejus and 12 more
Reacted by gnovikov, Peter Darrow, Kostis Anagnostopoulos, Yevgnen, Aaron Wright, rogerio-geru, tsiq-alberto, David Stewart, Clint Mod, Ben Simpson and 75 more
Reacted by kernc, Pablo Aguiar and Dmitry Kazakov
Reacted by gnovikov, Petter Strandmark, Dani Hodovic, Šarūnas Nejus and Mattwmaster58
Reacted by Qiushi Pan, gc-ss, Eirik Rolland Enger and Michael Aquilina
Reacted by Chun.Zheng, Robin Fourcade, Alex Thiele and Richard Höchenberger
It's not about adding commands to poetry. This issue was about extending the backend to support editable installs using a package installer like pip, which it now does.
@NeilGirdhar
This is a distinction without a difference. It reads the same as "this issue isn't about adding a feature. it's about adding a feature."
There is a reason why I said what I am saying is "in simple terms"
This is a distinction without a difference. It reads the same as "this issue isn't about adding a feature. it's about adding a feature."
There is a difference:
Adding commands to poetry means adding to the front end, i.e., things you do on the command line poetry add, poetry install, etc. Extending the backend is completely different. These are not commands that the user does. These are hooks that are accessed by the installer.
The reason that the backend has to change is that you need to be able to install a poetry project in editable mode in an ordinary (non-poetry) virtual environment. The front-end won't help you there.
Reacted by finswimmer, Corentin Bettiol, Flávio Lisbôa and Brian Ealdwine
Another possible reason to be using a setup.py is when handling with system drivers. I was working with a python project that needed control of the I2C-bus to communicate (i.e. i2c-dev).
I set everything up with adding my own user to the correct group (i2c), and everything was working when running the script outside of Poetry (running via Pyenv). When I tried to run it via poetry run I only got errors regarding permissions. I double-checked the user in the virtual environment, and everything seemed fine but still couldn't get it to work.
I didn't spend a lot of time on it as I found the workaround in here regarding moving the setup.py from the tarball and installing my package as editable install via pip to work fine. Might even be there is already some workaround in Poetry?
If that is not the case, this might not be a reason for making changes. It is however a possible solution if you are working closer with system drivers and are having issues with permissions.
@golgor Are you looking for help? If so, I'm happy to help where I can on a Discussion. Let me know. You could provide some more info about your pyproject.toml and dig deeper.
@adam-grant-hendry As mentioned I got it to work, but it might not be a good solution. I will write in the discussion, thanks for reaching out!
Edit:
I tested it again just now with using poetry run <script> and it was actually working. I did some trouble-shooting again and it seems that the problem might actually be in the implementation of the terminal in VS Code. If I run poetry run <script> in my system terminal, everything works great, but if I run the same command in the internal VS Code terminal I get permission problem (even though the user is correct).
I.e. this doesn't seem to be a problem for Poetry but rather some settings regarding the terminal setup of VS Code. I guess it doesn't make sense to write anything in the discussion then. I will look into this elsewhere. Thanks a lot though for reaching and offer help.
Hey all, this issue has been conflated and confused many times, and the issue it was meant to address has been long since solved. Most of the conversation relates to workflow issues, X-Y questions, or possible feature requests.
For those stumbling onto this issue, check out @finswimmer's summary, which I will re-state here:
When you poetry install, the root package(s) (the ones that live in your repo) are installed as editable into your venv.
Path dependencies with develop = true in pyproject.toml are installed as editable.
Poetry 1.2 betas add a poetry add --editable that sets the develop flag in pyproject.toml.
poetry-core also supports PEP 660 in the stable and beta versions, which allows for a Poetry-managed project to be installed in editable mode by any PEP 517 frontend (e.g. Poetry itself, pip, etc) that also supports PEP 660.
If you want to discuss workflow issues/improvements, please head over to the Discussions tab or join the Discord server.
If you're looking for a feature/enhancement that can streamline your workflow related to this, please do a good look to make sure there are no duplicate issues first (or ask on Discussions/Discord if you're not sure) -- then open an issue with your suggested feature/design.
I'll be locking this issue as it's considered long-solved and further comments are just sending a ton of notifications and blurring the issues under discussion.
If you try to install a poetry package locally using pip in editable mode pip install --editable ./ and get an error like ERROR: File "setup.py" not found. Directory cannot be installed in editable mode. You must make sure your pip version is > 21.3 and your poetry project specifies poetry-core version > 1.0.0:
Activity
sdispater commentedon Apr 3, 2018
No, this is not possible right now. And I don't think I will add an equivalent since it always seemed like a hack to me. But I might be wrong.
Why do you need
pip install -e .? So I can see if there is a "poetry way" to do what you want.kootenpv commentedon Apr 4, 2018
I often depend on some local packages, for which I want to be able to change some code and not have to reinstall.
sdispater commentedon Apr 4, 2018
I see.
The thing is
poetryis a dependency/project management tool and is not intended for such use cases.However, if you really want to to this, you can build your project
poetry buildand take thesetup.pyfile from the generated tarball and then you should be able to dopip install -e.kootenpv commentedon Apr 4, 2018
Ah sorry, with local I mostly meant "developing local packages". I do believe
poetryis also for helping with that? It sounds like barely any work to automate that part and create e.g. thepoetry developcommand.sdispater commentedon Apr 4, 2018
Well, poetry can help you develop local packages by orchestrating your dependencies, sure. But it is not meant to support the use case of having only local packages that depend on each other since this is not the best practice that poetry tries to endorse.
However, if you are willing to make a Pull Request, I would gladly take a look at it.
winni2k commentedon Apr 5, 2018
I might be off the mark here, but in my experience, I usually use
pip install -e .in order to allow my acceptance tests to see the python project I am testing. Is that what we are talking about here?sdispater commentedon Apr 5, 2018
I don't see why you would need
pip install -e .for your tests to work. If you are inside a virtualenv your dependencies should be picked up by your tests.In poetry that would be:
poetry install # install your dependencies poetry run pytest tests/kootenpv commentedon Apr 5, 2018
I'm not sure, but when you share a module in git, with other dev members, it's nice when it is updated automatically on pull. Or is this automatically managed in pycharm or something? I use emacs without virtualenvs but just simply different python versions.
winni2k commentedon Apr 6, 2018
In Pycharm you set the environment by choosing a python interpreter in your directory tree. Packages are discovered from that AFAIK.
winni2k commentedon Apr 6, 2018
I guess this is a bit of a style question, but I like to build a wheel for local packages and use pip to install them into my venv. Is that the workflow that is intended by
poetry?sdispater commentedon Apr 6, 2018
@winni2k Not at the moment, no. For now, poetry assumes each dependency is located in a remote repository (PyPI or a private one) or is a VCS dependency, and does not support local packages.
That might change in the future, however but I can't give you an ETA.
I am trying first to support the most common use cases, like installing from PyPI before diving into more specific workflow, especially if they are not the recommended way of managing packages.
kootenpv commentedon Apr 6, 2018
It now also does not allow me to use it in the interactive interpreter :/
I tried using
poetry build, then copy out thesetup.pyto the root level but that doesn't work. I'm very disappointed :(Until this becomes important, I wish there'd be a nice hack. I'm wondering though how do you develop - how do you avoid having to constantly reinstall?
sdispater commentedon Apr 6, 2018
@kootenpv I just tested and copying the
setup.pyfile works.I don't know how you develop, but I never need
pip install -e .. I either upload my packages to PyPI or a private index, or I install from a git repository.woutervh commentedon Apr 18, 2018
I don't know how you develop, but I never need pip install -e .. I either upload my packages to PyPI or a private index, or I install from a git repositoryUgh, that is not developing, that is installing a finished package.
These are roughly equivalent, in your src dir:
It's called "installing a package in development mode". They are the starting point of beginning development. If you are not familiar with that, then I honestly do not understand how you do development.
I know two ways of doing development without it:
Are you recommending this? (I hope not)
sdispater commentedon Apr 18, 2018
No, I don't modify
sys.path(). And please don't be condescending.So, if I develop a library (or an application for that matter) I put myself in my project directory. At this point I have access to my module: I can import it in my tests to test it.
You can test this yourself: clone the
poetryrepository place yourself in it install the dependencies withpoetry installand executepoetry run pytest tests/and everything will work. You do not needpip install -e .If you need it in another project, and that is why you install it in develop mode, the you have dependencies between project and in this case I recommend to use a private index and release preversions or installing from git repository and updating when needed.
187 remaining items
NeilGirdhar commentedon Mar 4, 2022
@adam-grant-hendry I'm not sure.
adam-grant-hendry commentedon Mar 4, 2022
@NeilGirdhar I've created a new
Discussiontitled "RE: Issue #34 -pip install -e . equivalent?" (#5276). Please feel free to join me there.adam-grant-hendry commentedon Mar 4, 2022
@NeilGirdhar
This is a distinction without a difference. It reads the same as "this issue isn't about adding a feature. it's about adding a feature."
There is a reason why I said what I am saying is "in simple terms"
NeilGirdhar commentedon Mar 4, 2022
There is a difference:
Adding commands to poetry means adding to the front end, i.e., things you do on the command line
poetry add,poetry install, etc. Extending the backend is completely different. These are not commands that the user does. These are hooks that are accessed by the installer.The reason that the backend has to change is that you need to be able to install a poetry project in editable mode in an ordinary (non-poetry) virtual environment. The front-end won't help you there.
golgor commentedon Mar 7, 2022
Another possible reason to be using a setup.py is when handling with system drivers. I was working with a python project that needed control of the I2C-bus to communicate (i.e.
i2c-dev).I set everything up with adding my own user to the correct group (
i2c), and everything was working when running the script outside of Poetry (running via Pyenv). When I tried to run it viapoetry runI only got errors regarding permissions. I double-checked the user in the virtual environment, and everything seemed fine but still couldn't get it to work.I didn't spend a lot of time on it as I found the workaround in here regarding moving the setup.py from the tarball and installing my package as editable install via pip to work fine. Might even be there is already some workaround in Poetry?
If that is not the case, this might not be a reason for making changes. It is however a possible solution if you are working closer with system drivers and are having issues with permissions.
adam-grant-hendry commentedon Mar 9, 2022
@golgor Are you looking for help? If so, I'm happy to help where I can on a Discussion. Let me know. You could provide some more info about your
pyproject.tomland dig deeper.golgor commentedon Mar 9, 2022
@adam-grant-hendry As mentioned I got it to work, but it might not be a good solution. I will write in the discussion, thanks for reaching out!
Edit:
I tested it again just now with using poetry run <script> and it was actually working. I did some trouble-shooting again and it seems that the problem might actually be in the implementation of the terminal in VS Code. If I run poetry run <script> in my system terminal, everything works great, but if I run the same command in the internal VS Code terminal I get permission problem (even though the user is correct).
I.e. this doesn't seem to be a problem for Poetry but rather some settings regarding the terminal setup of VS Code. I guess it doesn't make sense to write anything in the discussion then. I will look into this elsewhere. Thanks a lot though for reaching and offer help.
Merge pull request python-poetry#34 from abn/fix/typo
Fix editable installation
fix: fix editable installation via pip
fix: fix editable installation via pip
thautwarm commentedon Jul 15, 2022
Cross-language project here. Poetry troubles a lot.
neersighted commentedon Jul 24, 2022
Hey all, this issue has been conflated and confused many times, and the issue it was meant to address has been long since solved. Most of the conversation relates to workflow issues, X-Y questions, or possible feature requests.
For those stumbling onto this issue, check out @finswimmer's summary, which I will re-state here:
poetry install, the root package(s) (the ones that live in your repo) are installed as editable into your venv.develop = truein pyproject.toml are installed as editable.poetry add --editablethat sets thedevelopflag in pyproject.toml.poetry-core also supports PEP 660 in the stable and beta versions, which allows for a Poetry-managed project to be installed in editable mode by any PEP 517 frontend (e.g. Poetry itself, pip, etc) that also supports PEP 660.
If you want to discuss workflow issues/improvements, please head over to the Discussions tab or join the Discord server.
If you're looking for a feature/enhancement that can streamline your workflow related to this, please do a good look to make sure there are no duplicate issues first (or ask on Discussions/Discord if you're not sure) -- then open an issue with your suggested feature/design.
I'll be locking this issue as it's considered long-solved and further comments are just sending a ton of notifications and blurring the issues under discussion.
neersighted commentedon Jul 25, 2022
An addendum from @mraleson on Discord:
In essence, what I wrote about above only applies to contemporary versions of poetry-core and pip.