Install pycocotools with poetry( not PEP 517/518 compliant)

1.2k Views Asked by At

I am trying to install Pycocotools(PythonAPI) package with Poetry, but it fails to do so. As read in this case, it seems that this package is not packaged properly, and therefore poetry is unable to install it.

I tried to follow the procedure on linked question, but build failed. My purpose is to get this to work along with torch etc.

One option I guess is to submit an issue to the relevant package, but I dont think any changes will be made to their repo, so I am left probably with fixing it myself. Thanks

poetry --version #1.2.0a1

poetry add pycocotools

 Command ['/home/david/.cache/pypoetry/virtualenvs/torch-coco-detection-l0t67CWY-py3.6/bin/python',

'/home/david/.local/share/pypoetry/venv/lib/python3.6/site-packages/virtualenv/seed/wheels/embed/pip-21.0.1-py3-none-any.whl/pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/david/.cache/pypoetry/virtualenvs/torch-coco-detection-l0t67CWY-py3.6', '--no-deps', 'file:/home/david/.cache/pypoetry/artifacts/09/27/0c/fc4978bf6a0608be936e16316e3c2ded466882d6fea591754d92e4f931/pycocotools-2.0.2.tar.gz'] errored with the following return code 1, and output: Processing /home/david/.cache/pypoetry/artifacts/09/27/0c/fc4978bf6a0608be936e16316e3c2ded466882d6fea591754d92e4f931/pycocotools-2.0.2.tar.gz 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 'error' ERROR: Command errored out with exit status 1:

2

There are 2 best solutions below

0
On

There is a fork of poetry that I maintain called relaxed-poetry that relaxes some of the enforcements that is made by poetry. It can install packages like pycocotools without errors. Give it a try if you think it can help you - it can be installed side by side with poetry.

0
On

In my case, while using pyenv, I just downgraded the python version which wasn't compatible with the project I was working on.

pyenv install 3.X.X 
pyenv global 3.X.X
poetry install