-1

I am using Poetry version 1.1.7.

I want to run CompositeKey_worker.py through poetry: poetry run python3 CompositeKey_worker.py.

It states click isn't installed.

I add click as a dependency, and ensure it is already installed.

I run it again but gives returns the error.

Note: Running poetry install gives a separate error: post

me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ poetry run python3 CompositeKey_worker.py
Traceback (most recent call last):
  File "CompositeKey_worker.py", line 4, in <module>
    import click
ModuleNotFoundError: No module named 'click'
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ poetry add click
The following packages are already present in the pyproject.toml and will be skipped:

  • click

If you want to update it to the latest compatible version, you can use `poetry update package`.
If you prefer to upgrade it to the latest available version, you can use `poetry add package@latest`.

Nothing to add.
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ pip install click
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: click in /home/me/.local/lib/python3.8/site-packages (8.0.1)
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ poetry run python3 CompositeKey_worker.py
Traceback (most recent call last):
  File "CompositeKey_worker.py", line 4, in <module>
    import click
ModuleNotFoundError: No module named 'click'
me@LAPTOP-G1DAPU88:~/.ssh/workers-python/workers/CompositeKey/CompositeKey$ 
vvvvv
  • 25,404
  • 19
  • 49
  • 81
  • have you tried running `poetry install`? – Matthew Barlowe Aug 06 '21 at 12:04
  • Poetry install gives me this error: https://stackoverflow.com/questions/68680055/poetry-install-connectionerror-failed-to-establish-a-new-connection-errno :( –  Aug 06 '21 at 12:07

2 Answers2

2

poetry self update 1.0.10 then poetry install.

As mentioned here. Two separate errors, both caused by poetry version.

0

It seems like you have a private Python packages repository set. You can use poetry config --help and their docs to debug your settings (remove the private repository if you didn't mean to use it) and then try installing click again.

Alternatively, if you're under a lot of pressure to just get it running, and you prefer circumventing debugging poetry, you can use the native Python environment management tool, venv. They, too, have nice docs that you can take the time reading and solving your issue.

Quick bootstrap

python3 -m venv justdoit
source justdoit/activate
pip install click
python CompositeKey_worker.py
edd
  • 1,307
  • 10
  • 10
  • 1
    That would be a good practical solution, if it were for just; but I need a production level ready setup to be pulled down from GitHub. –  Aug 06 '21 at 12:53
  • 1
    @StressedBoi_69420, is there a DevOps team that can help you setup your env? Because the problem most likely is beyond the scope of Python tools. But a network configuration. For example, where I work, no access is given by default; You have to request access, the first time you try to use it. As, the root of the issue is networking connectivity with the private repository (according to your linked SO question). All this assuming the private repository is correctly setup (mirrors PyPI, most likely). – edd Aug 06 '21 at 12:59
  • 1
    On my other Stack post, referenced in this post above, I did `poetry self update 1.0.10` and `poetry install` is now giving me installs now. Once this is done, I'll try `poetry run python3 CompositeKey_worker.py` again to see if that does it. I suspect these 2 issues were related. –  Aug 06 '21 at 13:04