I haven't investigated the cause in detail, but a memo of the solution.
I got the following error when installing a git repo with poetry. Name it a repo named hoge.
(.venv) bash-3.2$ poetry update
Updating dependencies
Resolving dependencies... (10.2s)
Writing lock file
Package operations: 12 installs, 0 updates, 0 removals
- Installing hoge (0.0.1 acd565a)
[EnvCommandError]
Command ['/Users/kazeto/Works/aaa/.venv/bin/pip', 'install', '--no-deps', '-U', '-e', '/Users/kazeto/Works/aaa/.venv/src/hoge'] errored with the following return code 1, and output:
Obtaining file:///Users/kazeto/Works/aaa/.venv/src/hoge
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Installing collected packages: hoge
Running setup.py develop for hoge
ERROR: Command errored out with exit status 1:
command: /Users/kazeto/Works/aaa/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/kazeto/Works/aaa/.venv/src/hoge/setup.py'"'"'; __file__='"'"'/Users/kazeto/Works/aaa/.venv/src/hoge/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
cwd: /Users/kazeto/Works/aaa/.venv/src/hoge/
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/kazeto/Works/aaa/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/kazeto/Works/aaa/.venv/src/hoge/setup.py'"'"'; __file__='"'"'/Users/kazeto/Works/aaa/.venv/src/hoge/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
By the way, as shown in the error log, when I tried to check the log and executed the code that caused the error by hand, it entered normally and I did not understand the cause well ...
(.venv) bash-3.2$ /Users/kazeto/Works/aaa/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/kazeto/Works/aaa/.venv/src/hoge/setup.py'"'"'; __file__='"'"'/Users/kazeto/Works/aaa/.venv/src/hoge/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(_le__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
running develop
running egg_info
creating hoge.egg-info
writing hoge.egg-info/PKG-INFO
writing dependency_links to hoge.egg-info/dependency_links.txt
writing top-level names to hoge.egg-info/top_level.txt
writing manifest file 'hoge.egg-info/SOURCES.txt'
reading manifest file 'hoge.egg-info/SOURCES.txt'
writing manifest file 'hoge.egg-info/SOURCES.txt'
running build_ext
Creating /Users/kazeto/Works/aaa/.venv/lib/python3.7/site-packages/hoge.egg-link (link to .)
Adding hoge 0.0.1 to easy-install.pth file
Installed
And when I looked in .venv, setuptools was included.
For the time being, install it by adding setuptools to build-system with pyproject.toml of git repo (hoge in this case).
[build-system]
requires = ["poetry>=1.00"]
build-backend = "poetry.masonry.api"
[build-system]
requires = ["poetry>=1.00", "setuptools"]
build-backend = "poetry.masonry.api"
I found an issue now. The version of poetry is different, but this is probably it. https://github.com/python-poetry/poetry/issues/3001
Recommended Posts