question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry seems to ignore virtualenvs.create

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Debian GNU/Linux 10 (Docker python:3.6)
  • Poetry version: 1.1.6
  • Link of a Gist with the contents of your pyproject.toml file: gist link

Issue

I recently recreated my Docker images, and replaced the old get-poetry.py with install-poetry.py, and suddenly my entry command was not working anymore, failing with ModuleNotFoundError.

My poetry install invocations correctly output Skipping virtualenv creation, as specified in config file., which is what I asked via poetry config virtualenvs.create false, but by looking around I found them being placed in the POETRY_HOME/venv folder, and therefore not being found by my simple python -m entrypoint:

root@71978f3d0878:/code/src# ls /opt/poetry/venv/lib/python3.6/site-packages/
Babel-2.9.1.dist-info			       blackd				factory_boy-2.12.0.dist-info	     lockfile			      pyOpenSSL-20.0.1.dist-info	 shellingham-1.4.0.dist-info
CacheControl-0.12.6.dist-info		       blib2to3				faker				     lockfile-0.12.2.dist-info	      pyasn1				 six-1.16.0.dist-info

Am I doing something wrong, or did something break with some of the updates I skipped?

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
TheGreatRefrigeratorcommented, Aug 5, 2021

I still encounter this problem with the latest 1.2.0a2 release, which should contain the fix? OS of the Docker image Debian GNU/Linux 10 \n \l

FROM tiangolo/uvicorn-gunicorn:python3.8

# get DEV argument from docker-compose file
ARG DEV

# Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | POETRY_HOME=/opt/poetry python - --preview && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

COPY ./pyproject.toml ./poetry.lock* /app/

RUN if [ "$DEV" = "1" ] ; then poetry install --no-root ; else poetry install --no-root --no-dev ; fi

when doing poetry install, poetry says that it skips virtual env creation (as defined by the config), but still installs all packages to $POETRY_HOME/venv/lib and not to /usr/local/lib/python3.8/site-packages which is used by the system python interpreter and where it is installed when using the get-poetry.py script.

running python from anywhere else than in $POETRY_HOME/venv/lib/python3.8/site-packages/ will not let me import the installed dependencies specified in pyproject.toml.

1reaction
TheGreatRefrigeratorcommented, Aug 23, 2021

@sdispater Yes, version 1.1.8 fixes the issue, thanks. Will this be included in 1.2 at some point as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does "Skipping virtualenv creation, as specified in config ...
A poetry config virtualenvs.create true is what you are looking for. This setting is the default value. So there is a good chance...
Read more >
Configuration | Documentation | Poetry - Python dependency ...
poetry config virtualenvs.create false --local ... This configuration is ignored when installer.parallel is set to false .
Read more >
Python Virtual Environments tutorial using ... - SerpApi
A mini-guided Python tutorial showing how to use virtual environment and why it's matters on virtualenv and poetry illustrated examples.
Read more >
A Poetic Apology. Or Why Should You Use Poetry to Manage…
Since this seems a dead-end, you choose to start from scratch by manually creating a requirements.txt file with only production dependencies pandas==0.25.3
Read more >
Announcing Poetry 1.2.0 -- Python dependency management ...
That seems like an overreaction: the old installer cannot install the ... It's one line in poetry.toml and venv will be created in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found