First run left me with more questions than answers #919
Replies: 1 comment 2 replies
-
It should, yes. Using a system interpreter is a correct thing to do. You probably saw lots of backtracking because of the empty "requires-python". I just tried myself, using Python 3.8 and requires-python >= 3.8, pdm add streamlit and everything went fine.
From my understanding, when a venv is activated, PDM is indeed supposed to install things in it, and therefore python should find installed packages and you should be able to launch scripts from the CLI. But I've never used PDM with venvs so I can't tell for sure.
There's |
Beta Was this translation helpful? Give feedback.
-
This is a recollection of my first run of
pdm
:pipx install pdm
, so far so goodpdm init
(good) andpdm add streamlit
. This led to lots of backtracking, probably because it was using the system-wide/usr/bin/python3.9
interpreter ❗ so ICtrl+C
'ed.python3.9 -m venv .venv && source .venv/bin/activate
, and ranpdm add streamlit
again. Initially I didn't set any lower bound to the Python version, which led toResolutionImpossible
ifrequires-python
is empty #917. Then I tried--dry-run
and got--dry-run
option ofpdm add
still createspdm.lock
and empty__pypackages__
#918. Eventually I got it installed though, so let's continue.import urllib3
(which is a dependency of streamlit), but got a "module not found". I mistakenly assumed that pdm would install the dependencies in the.venv
if instructed to do so (since step 4,.pdm.toml
has the.venv
interpreter as thepath
) 😕export PYTHONPATH='/src/.venv/lib/python3.9/site-packages/pdm/pep582'
madeimport urllib3
work 🏁🥵It was a rough ride, but now I think I got it. Things that in my opinion could be improved:
pdm
advertises itself as a package manager that "doesn't need to create a virtualenv at all", maybe the default behavior when using a system-wide interpreter should be exactly the same as a fresh venv? Or maybe I'm misunderstanding something?venv
, perhaps some feedback could be given to the user that PEP 582 is not enabled so they don't get surprised that packages don't get installed there?venv
, PEP 582 is not necessary at all, and the packages could be installed in thevenv
directly.pdm --pep582
does all the work magically on Windows, perhaps there could be a command that works only for the current shell, in case folks want to experiment before changing their.bash_profile
?What do you think?
Beta Was this translation helpful? Give feedback.
All reactions