1.1.0b2 causes EnvCommandError (Non-posix paths with file:// protocol on Windows)
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: Windows 10
- Poetry version: 1.1.0b2
- Link of a Gist with the contents of your pyproject.toml file:
Issue
When on Poetry 1.0.10 there are no issues. But after having updated to poetry 1.1.0b2, I constantly get an EnvCommandError caused by a FileNotFoundError (a temporary setup.py file is not found):
$ poetry --version
Poetry version 1.1.0b2
$ poetry lock
Updating dependencies
Resolving dependencies...
Writing lock file
$ poetry install -vvv
Using virtualenv: C:\Users\fredrik\code\repos\mylittleci\venv
Installing dependencies from lock file
Finding the necessary packages for the current system
Package operations: 2 installs, 0 updates, 0 removals
β’ Installing zipp (3.1.0)
Stack trace:
7 c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:183 in _execute_operation
181β
182β try:
β 183β result = self._do_execute_operation(operation)
184β except EnvCommandError as e:
185β if e.e.returncode == -2:
6 c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:257 in _do_execute_operation
255β return 0
256β
β 257β result = getattr(self, "_execute_{}".format(method))(operation)
258β
259β if result != 0:
5 c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:394 in _execute_install
392β
393β def _execute_install(self, operation): # type: (Install) -> None
β 394β return self._install(operation)
395β
396β def _execute_update(self, operation): # type: (Update) -> None
4 c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:432 in _install
430β args.insert(2, "-U")
431β
β 432β return self.run_pip(*args)
433β
434β def _update(self, operation):
3 c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\installation\executor.py:283 in run_pip
281β def run_pip(self, *args, **kwargs): # type: (...) -> int
282β try:
β 283β self._env.run_pip(*args, **kwargs)
284β except EnvCommandError as e:
285β output = decode(e.e.output)
2 c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:883 in run_pip
881β pip = self.get_pip_command()
882β cmd = pip + list(args)
β 883β return self._run(cmd, **kwargs)
884β
885β def _run(self, cmd, **kwargs):
1 c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:1151 in _run
1149β self.unset_env("__PYVENV_LAUNCHER__")
1150β
β 1151β return super(VirtualEnv, self)._run(cmd, **kwargs)
1152β
1153β def execute(self, bin, *args, **kwargs):
EnvCommandError
Command C:\Users\fredrik\code\repos\mylittleci\venv\Scripts\pip.exe install --no-deps file://C:\Users\fredrik\AppData\Local\pypoetry\Cache\artifacts\3f\29\e0\445941d0045028dce97085f4263281587225a49fa7dd09f41e4c2752af\zipp-3.1.0-py3-none-any.whl errored with the following return code 1, and output:
Processing c:\users\fredrik\appdata\local\pypoetry\cache\artifacts\3f\29\e0\445941d0045028dce97085f4263281587225a49fa7dd09f41e4c2752af\zipp-3.1.0-py3-none-any.whl
ERROR: Command errored out with exit status 1:
command: 'c:\users\fredrik\code\repos\mylittleci\venv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\fredrik\\AppData\\Local\\Temp\\pip-req-build-gsp4euj0\\setup.py'"'"'; __file__='"'"'C:\\Users\\fredrik\\AppData\\Local\\Temp\\pip-req-build-gsp4euj0\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\fredrik\AppData\Local\Temp\pip-pip-egg-info-_md_1odm'
cwd: C:\Users\fredrik\AppData\Local\Temp\pip-req-build-gsp4euj0\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\fredrik\AppData\Local\Programs\Python\Python37\lib\tokenize.py", line 447, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\fredrik\\AppData\\Local\\Temp\\pip-req-build-gsp4euj0\\setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
at c:\users\fredrik\.local\pipx\venvs\poetry\lib\site-packages\poetry\utils\env.py:915 in _run
911β output = subprocess.check_output(
912β cmd, stderr=subprocess.STDOUT, **kwargs
913β )
914β except CalledProcessError as e:
β 915β raise EnvCommandError(e, input=input_)
916β
917β return decode(output)
918β
919β def execute(self, bin, *args, **kwargs):
The contents of my pyproject.toml
:
[tool.poetry]
name = "mylittleci"
version = "0.0.1"
authors = ["Fredrik <***@***.***>"]
description = "mylittleci"
[tool.poetry.dependencies]
python = "^3.7"
[tool.poetry.dev-dependencies]
importlib_metadata = "^1.7.0"
[tool.poetry.scripts]
calculator = "mylittleci.cli.calculator:main"
[build-system]
# https://python-poetry.org/docs/faq/#is-tox-supported
requires = ["poetry-core>=1.0.0a5"]
build-backend = "poetry.core.masonry.api"
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
os β Miscellaneous operating system interfaces
In particular, on Windows adding O_BINARY is needed to open files in binary mode. This function can support paths relative to directory descriptors...
Read more >FTP - Connectors
The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files between a client and server on a computer...
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
@fredrikaverpil freel free to submit a PR for the code you linked above by replacing
str(archive)
witharchive.as_posix()
, there is no need to use the windows check, letpathlib
worry about that πIβll clean up the other bits later anyway.
@fredrikaverpil thank you for the details you have provided. The issue here is the following piece of code.
https://github.com/python-poetry/poetry/blob/c77299ed373df50ec459907671f65f5da3de5070/poetry/installation/executor.py#L425
This is problematic because
str()
as this is not cross-platform safe. Looking into this, at the moment the type ofarchive
is not necessarily guarenteed to be aPath
instance either, this needs to be fixed and the above use ofstr(archive)
needs to be replaced witharchive.as_posix()
instead.