Poetry tries to remove setuptools and then complains it can't find it
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 10
- Poetry version: 1.1.7
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/nyuszika7h/238727b812cfce957e0e34e1143b160f
Issue
When running poetry install
, Poetry tries to remove setuptools
, and then later complains that setuptools is not found when trying to install future
.
I suspect this may be because win10toast
depends on setuptools, but that package is skipped due to the platform not being Windows.
❯ poetry install -vvv
Creating virtualenv test in /home/nyuszika7h/test/.venv
Using virtualenv: /home/nyuszika7h/test/.venv
Installing dependencies from lock file
Finding the necessary packages for the current system
Package operations: 7 installs, 0 updates, 1 removal, 6 skipped
• Removing importlib-metadata (4.6.0): Pending...
• Removing importlib-metadata (4.6.0): Skipped for the following reason: Not currently installed
• Removing pypiwin32 (223): Pending...
• Removing pypiwin32 (223): Skipped for the following reason: Not currently installed
• Removing pywin32 (301): Pending...
• Removing pywin32 (301): Skipped for the following reason: Not currently installed
• Removing win10toast (0.9): Pending...
• Removing win10toast (0.9): Skipped for the following reason: Not currently installed
• Removing typing-extensions (3.10.0.0): Pending...
• Removing typing-extensions (3.10.0.0): Skipped for the following reason: Not currently installed
• Removing zipp (3.4.1): Pending...
• Removing zipp (3.4.1): Skipped for the following reason: Not currently installed
• Removing setuptools (57.0.0): Pending...
• Removing setuptools (57.0.0): Removing...
• Removing setuptools (57.0.0)
• Installing soupsieve (2.2.1): Pending...
• Installing soupsieve (2.2.1): Installing...
• Installing soupsieve (2.2.1)
• Installing beautifulsoup4 (4.9.3): Pending...
• Installing beautifulsoup4 (4.9.3): Installing...
• Installing cssutils (2.3.0): Pending...
• Installing cssutils (2.3.0): Installing...
• Installing future (0.18.2): Pending...
• Installing future (0.18.2): Installing...
• Installing future (0.18.2): Failed
EnvCommandError
Command ['/home/nyuszika7h/test/.venv/bin/pip', 'install', '--no-deps', 'file:///home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz'] errored with the following return code 1, and output:
Processing /home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/nyuszika7h/test/.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-1yncrz1a/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-1yncrz1a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-gd9atrnx
cwd: /tmp/pip-req-build-1yncrz1a/
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
WARNING: Discarding file:///home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 21.1.2; however, version 21.1.3 is available.
You should consider upgrading via the '/home/nyuszika7h/test/.venv/bin/python -m pip install --upgrade pip' command.
at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py:1101 in _run
1097│ output = subprocess.check_output(
1098│ cmd, stderr=subprocess.STDOUT, **kwargs
1099│ )
1100│ except CalledProcessError as e:
→ 1101│ raise EnvCommandError(e, input=input_)
1102│
1103│ return decode(output)
1104│
1105│ def execute(self, bin, *args, **kwargs):
• Installing lxml (4.6.3): Pending...
• Installing lxml (4.6.3): Installing...
• Installing six (1.16.0): Pending...
• Installing six (1.16.0): Installing...
• Installing six (1.16.0)
• Installing cssutils (2.3.0)
• Installing future (0.18.2): Pending...
• Installing future (0.18.2): Installing...
• Installing future (0.18.2): Failed
EnvCommandError
Command ['/home/nyuszika7h/test/.venv/bin/pip', 'install', '--no-deps', 'file:///home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz'] errored with the following return code 1, and output:
Processing /home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/nyuszika7h/test/.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-1yncrz1a/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-1yncrz1a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-gd9atrnx
cwd: /tmp/pip-req-build-1yncrz1a/
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
WARNING: Discarding file:///home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 21.1.2; however, version 21.1.3 is available.
You should consider upgrading via the '/home/nyuszika7h/test/.venv/bin/python -m pip install --upgrade pip' command.
at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py:1101 in _run
1097│ output = subprocess.check_output(
1098│ cmd, stderr=subprocess.STDOUT, **kwargs
1099│ )
1100│ except CalledProcessError as e:
→ 1101│ raise EnvCommandError(e, input=input_)
1102│
1103│ return decode(output)
1104│
1105│ def execute(self, bin, *args, **kwargs):
• Installing lxml (4.6.3): Pending...
• Installing lxml (4.6.3): Installing...
• Installing lxml (4.6.3)
• Installing six (1.16.0): Pending...
• Installing six (1.16.0): Installing...
• Installing six (1.16.0)
• Installing beautifulsoup4 (4.9.3)
• Installing cssutils (2.3.0): Pending...
• Installing cssutils (2.3.0): Installing...
• Installing cssutils (2.3.0)
• Installing future (0.18.2): Pending...
• Installing future (0.18.2): Installing...
• Installing future (0.18.2): Failed
EnvCommandError
Command ['/home/nyuszika7h/test/.venv/bin/pip', 'install', '--no-deps', 'file:///home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz'] errored with the following return code 1, and output:
Processing /home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz
ERROR: Command errored out with exit status 1:
command: /home/nyuszika7h/test/.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-1yncrz1a/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-1yncrz1a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-gd9atrnx
cwd: /tmp/pip-req-build-1yncrz1a/
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
WARNING: Discarding file:///home/nyuszika7h/.cache/pypoetry/artifacts/f8/58/55/86be1f567b212fdd98854d12815964a49db8fb1bcff725018e5f95c61d/future-0.18.2.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 21.1.2; however, version 21.1.3 is available.
You should consider upgrading via the '/home/nyuszika7h/test/.venv/bin/python -m pip install --upgrade pip' command.
at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py:1101 in _run
1097│ output = subprocess.check_output(
1098│ cmd, stderr=subprocess.STDOUT, **kwargs
1099│ )
1100│ except CalledProcessError as e:
→ 1101│ raise EnvCommandError(e, input=input_)
1102│
1103│ return decode(output)
1104│
1105│ def execute(self, bin, *args, **kwargs):
• Installing lxml (4.6.3): Pending...
• Installing lxml (4.6.3): Installing...
• Installing lxml (4.6.3)
• Installing six (1.16.0): Pending...
• Installing six (1.16.0): Installing...
• Installing six (1.16.0)
To clarify: Running poetry lock
from Poetry 1.2.0a1 seems to cause the lock file to include setuptools, which triggers the issue with Poetry <= 1.1.7. Running poetry lock
from Poetry 1.1.7 makes it exclude setuptools and there is no issue.
Install with Poetry 1.1.7 | Install with Poetry 1.2.0a1 | |
---|---|---|
Lock file from Poetry 1.1.7 | ✅ | ✅ |
Lock file from Poetry 1.2.0a1 | ❌ | ✅ |
Also, both lock files were generated on Linux. I have not tested on Windows yet.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:42
- Comments:16 (5 by maintainers)
Top Results From Across the Web
How can Python Poetry be forced to use a certain setuptools ...
I found a workaround for my problem. In the case of pyhash, the dependency on use_2to3 has already been removed in the master...
Read more >Why you shouldn't invoke setup.py directly - Paul Ganssle
This does not mean that setuptools itself is deprecated, or that using setup.py to configure your package builds is going to be removed....
Read more >A Poetic Apology. Or Why Should You Use Poetry to Manage…
lock file already exists, if you now run poetry install then Poetry will resolve and install dependencies using the versions specified in such...
Read more >Poetry doens't use chosen python version - Render community
I'm trying to use Django 4.1.1 and Python 3.10.6. I specified PYTHON_VERSION environment variable to 3.10.6, but Poetry tries to use 3.7.10 ...
Read more >Dependency Management With Python Poetry
When your Python project relies on external packages, you need to make sure you're using the right version of each package. After an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Breaking backwards compatibility in a minor release is not the best experience. Is there really no way to make any required changes in a way that it doesn’t lead to mysterious breakage on earlier versions?
I still have this problem on 1.2.x