0

I have Poetry installed, and have a poetry.lock in the same cwd.

I want to perform poetry update/install.


Why can I not install poetry dependencies?

Terminal:

me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key/compositekey/tests$ pip3 install poetry
Requirement already satisfied: ...
me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key$ ls
Dockerfile  azure-pipeline-composite_key.yaml  compositekey  docs  poetry.lock  pyproject.toml
me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key$ poetry update
poetry: command not found
me@PF2DCSXD:/mnt/c/Users/user/Documents/GitHub/workers-python/workers/composite_key$ poetry install
poetry: command not found


Please let me know if there is anything else I can add to post.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
StressedBoi69420
  • 1,376
  • 1
  • 12
  • 40
  • 3
    The question is, where did `pip3` install `poetry`, and is that directory in your `PATH` variable? – chepner Nov 01 '21 at 16:32
  • Ohh, I hate PYTHONPATH ;( Couldn't tell you. How do I find out where a package is installed to? – StressedBoi69420 Nov 01 '21 at 16:38
  • 1
    add this to your .bashrc : PATH="$PATH:/usr/local/bin" – Philippe Nov 01 '21 at 16:42
  • 1
    It's the `PATH` not the `PYTHONPATH` that matters for whether _bash_ can find `poetry`; the `PYTHONPATH` controls only what _Python_ can import. – Charles Duffy Nov 01 '21 at 16:44
  • 1
    Anyhow -- if you want to know where the module is installed (which will give us a good clue about where the shell wrapper lives), a good place to start is `python -c 'import poetry; print(poetry.__file__)'` – Charles Duffy Nov 01 '21 at 16:45
  • 1
    @Philippe, unless the OP used `sudo` during the first `pip3 install`, it's unlikely to be in `/usr/local/bin` (well-designed operating systems and package managers don't let unprivileged accounts write to that directory out-of-the-box; the only widespread one I know that's so poorly thought-through as to permit such a thing is Homebrew, and consequently, I strongly advise against its use). More likely we have a location under their home directory. – Charles Duffy Nov 01 '21 at 16:45
  • 1
    @StressedBoi69420, ...if you think you installed it in the first place with `pip3` and without `sudo`, then `find "$HOME" -name poetry -print` is a good place to start in trying to locate the executable. Once you have a location, make sure that directory is in your PATH. – Charles Duffy Nov 01 '21 at 16:46
  • `python3 -c 'import poetry; print(poetry.__file__)' /home/me/.local/lib/python3.8/site-packages/poetry/__init__.py` @CharlesDuffy – StressedBoi69420 Nov 01 '21 at 16:48
  • 1
    @StressedBoi69420, great; do you have a `poetry` executable in `/home/me/.local/bin`? (It's a guess, but a fairly informed one). – Charles Duffy Nov 01 '21 at 16:49
  • Hypothetically, I should be able to do: `poetry run python3 .py`,`poetry install` or `poetry update`. I can't. – StressedBoi69420 Nov 01 '21 at 16:51
  • 1
    You can only run `poetry ` if you have a directory containing a `poetry` executable in your `PATH` (or a shell function or alias by the same name, but those aren't relevant here). That's why we're trying to figure out where that directory is, so we can amend your `PATH` appropriately. – Charles Duffy Nov 01 '21 at 16:51
  • Ah sorry, ok @CharlesDuffy – StressedBoi69420 Nov 01 '21 at 16:52
  • `$ find "$HOME" -name poetry -print /home/me/.local/bin/poetry /home/me/.local/lib/python3.8/site-packages/poetry` – StressedBoi69420 Nov 01 '21 at 16:53
  • 1
    Great, that confirms the earlier guess. `PATH=$PATH:$HOME/.local/bin` should fix your problem for the duration of the shell session in which it's run. – Charles Duffy Nov 01 '21 at 16:54
  • 1
    That's allowing me to do `poetry install` :). Thanks! What would be a permanent solution, for new shell sessions? Can always just copy and paste your last command ^ – StressedBoi69420 Nov 01 '21 at 17:01

0 Answers0