0

I decided to try combo of pyenv and poetry. And after creating test project and adding dependencies to it I always have the same error. Why poetry is trying to use not existing wheels, pip and setuptools? Maybe there are some configurations to be made

I am currently using

pyenv local 3.9.2
poetry add django

Creating virtualenv test in /Users/george.parhomenko/Projects/test/.venv

  RuntimeError

  failed to build image pip, wheel, setuptools because:
  Traceback (most recent call last):
    File "/Users/george.parhomenko/.poetry/lib/poetry/_vendor/py3.9/virtualenv/seed/embed/via_app_data/via_app_data.py", line 54, in _install
      with parent.non_reentrant_lock_for_key(wheel_img.name):
    File "/Users/george.parhomenko/.pyenv/versions/3.9.2/lib/python3.9/contextlib.py", line 117, in __enter__
      return next(self.gen)
    File "/Users/george.parhomenko/.poetry/lib/poetry/_vendor/py3.9/virtualenv/util/lock.py", line 144, in non_reentrant_lock_for_key
      with _CountedFileLock(str(self.path / "{}.lock".format(name))):
    File "/Users/george.parhomenko/.poetry/lib/poetry/_vendor/py3.9/filelock.py", line 323, in __enter__
      self.acquire()
    File "/Users/george.parhomenko/.poetry/lib/poetry/_vendor/py3.9/virtualenv/util/lock.py", line 31, in acquire
      super(_CountedFileLock, self).acquire(timeout=timeout, poll_intervall=poll_intervall)
    File "/Users/george.parhomenko/.poetry/lib/poetry/_vendor/py3.9/filelock.py", line 271, in acquire
      self._acquire()
    File "/Users/george.parhomenko/.poetry/lib/poetry/_vendor/py3.9/filelock.py", line 384, in _acquire
      fd = os.open(self._lock_file, open_mode)
  FileNotFoundError: [Errno 2] No such file or directory: '/Users/george.parhomenko/Library/Application Support/virtualenv/wheel/3.9/image/1/CopyPipInstall/pip-21.0.1-py3-none-any.lock'
  

  at ~/.poetry/lib/poetry/_vendor/py3.9/virtualenv/seed/embed/via_app_data/via_app_data.py:71 in run
       67│                 messages = ["failed to build image {} because:".format(", ".join(exceptions.keys()))]
       68│                 for value in exceptions.values():
       69│                     exc_type, exc_value, exc_traceback = value
       70│                     messages.append("".join(traceback.format_exception(exc_type, exc_value, exc_traceback)))
    →  71│                 raise RuntimeError("\n".join(messages))
       72│ 
       73│     @contextmanager
       74│     def _get_seed_wheels(self, creator):
       75│         name_to_whl, lock, fail = {}, Lock(), {}

And the same Traceback for pip and setuptools

  • It's not `poetry` itself who is trying to install pip, setuptools and wheel. It is `virtualenv` which is used under the hood to create the venv. But it looks strange. I only can recommend trying to reinstall the python version via pyenv and if this does not help, reinstalling poetry. – finswimmer Mar 25 '21 at 05:45
  • @finswimmer, have already tried but problem still exists – MrGeorgeOwl Mar 25 '21 at 16:27
  • poetry will usually make sure that all its dependencies are properly installed, but only when using [the official install script](https://python-poetry.org/docs/#installation), and not `pip`. You can try that and see if it helps. If that doesn't work it gets tricky to help without sitting in your chair. – Arne Mar 28 '21 at 17:07
  • @Arne, already tried too( It doesn't matter what I use official script or installing through pip it shows me the same error – MrGeorgeOwl Mar 29 '21 at 11:52
  • That's really unfortunate. It probably means that your system's python version that poetry uses to install itself was compiled without either pip, venv, and I don't know the brew commands that you'd need to run in order to install them. – Arne Mar 29 '21 at 21:47
  • @Arne somehow after updating brew I got python@2 In my brew list. I was thinking about removing it and try to compile python of latest version. And set it as system python – MrGeorgeOwl Mar 30 '21 at 10:54
  • that could be risky. macos might use python internally, and rely on version-specific features, so by replacing it you might end up not being able to boot up at all. something a little more simple that you can do is to compile a recent python version, as you planned, and then calling it manually for poetry's install script, e.g. you compile `python3.9.2`, and then run `curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3.9.2 -` – Arne Mar 30 '21 at 11:30
  • @Arne Tried right now and still no effect :/ – MrGeorgeOwl Mar 31 '21 at 19:20
  • if you can run both `python3.9.2 -m pip install pynapple` and `python3.9.2 -m venv venv` without issues, even though poetry doesn't work, I'd consider your laptop haunted and give up =( – Arne Mar 31 '21 at 20:11

0 Answers0