Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.10 NameError exception 'PosixPath' is not defined when creating virtual envrionment #2742

Closed
3 tasks done
pladdy opened this issue Jul 29, 2020 · 5 comments
Closed
3 tasks done
Labels
kind/bug Something isn't working as expected

Comments

@pladdy
Copy link

pladdy commented Jul 29, 2020

  • 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).

Issue

I noticed today when poetry was used in a centos image to install dependencies, it failed (output will be below). It looks like an exception is thrown when creating the virtual environment, which fails, but then poetry tries to install dependencies:

Step 16/16 : RUN poetry install -vvv
 ---> Running in 7316ee3aa652
/root/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
  "program uses threads.", RuntimeWarning)
The currently activated Python version 2.7.5 is not supported by the project (^3.7).
Trying to find and use a compatible version. 
Trying python3
Trying python3.8
Trying python3.7
Using python3.7 (3.7.5)
Creating virtualenv poetry-1.0.10-centos-postposix-WP7muOYE-py3.7 in /root/.cache/pypoetry/virtualenvs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'PosixPath' is not defined
Using virtualenv: /root/.cache/pypoetry/virtualenvs/poetry-1.0.10-centos-postposix-WP7muOYE-py3.7
Updating dependencies
Resolving dependencies...
   1: fact: poetry-1.0.10-centos-postposix is 0.1.0
   1: derived: poetry-1.0.10-centos-postposix
   1: fact: poetry-1.0.10-centos-postposix depends on jsonschema (^3.2.0)
   1: selecting poetry-1.0.10-centos-postposix (0.1.0)
   1: derived: jsonschema (^3.2.0)
   1: fact: jsonschema (3.2.0) depends on attrs (>=17.4.0)
   1: fact: jsonschema (3.2.0) depends on pyrsistent (>=0.14.0)
   1: fact: jsonschema (3.2.0) depends on six (>=1.11.0)
   1: fact: jsonschema (3.2.0) depends on importlib-metadata (*)
   1: selecting jsonschema (3.2.0)
   1: derived: importlib-metadata (*)
   1: derived: six (>=1.11.0)
   1: derived: pyrsistent (>=0.14.0)
   1: derived: attrs (>=17.4.0)
   1: selecting six (1.15.0)
   1: selecting attrs (19.3.0)
   1: fact: pyrsistent (0.16.0) depends on six (*)
   1: selecting pyrsistent (0.16.0)
   1: fact: importlib-metadata (1.7.0) depends on zipp (>=0.5)
   1: selecting importlib-metadata (1.7.0)
   1: derived: zipp (>=0.5)
   1: selecting zipp (3.1.0)
   1: Version solving took 0.639 seconds.
   1: Tried 1 solutions.

Writing lock file

[SolverProblemError]
The current project's Python requirement (2.7.5) is not compatible with some of the required packages Python requirement:
  - zipp requires Python >=3.6

Because no versions of jsonschema match >3.2.0,<4.0.0
 and jsonschema (3.2.0) depends on importlib-metadata (*), jsonschema (>=3.2.0,<4.0.0) requires importlib-metadata (*).
And because no versions of importlib-metadata match !=1.7.0
 and importlib-metadata (1.7.0) depends on zipp (>=0.5), jsonschema (>=3.2.0,<4.0.0) requires zipp (>=0.5).
Because zipp (3.1.0) requires Python >=3.6
 and no versions of zipp match >=0.5,<3.1.0 || >3.1.0, zipp is forbidden.
Thus, jsonschema is forbidden.
So, because poetry-1.0.10-centos-postposix depends on jsonschema (^3.2.0), version solving failed.

Traceback (most recent call last):
  File "/root/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/root/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/root/.poetry/lib/poetry/_vendor/py2.7/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/root/.poetry/lib/poetry/_vendor/py2.7/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/root/.poetry/lib/poetry/console/commands/install.py", line 69, in handle
    return_code = installer.run()
  File "/root/.poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/root/.poetry/lib/poetry/installation/installer.py", line 225, in _do_install
    ops = solver.solve(use_latest=whitelist)
  File "/root/.poetry/lib/poetry/puzzle/solver.py", line 36, in solve
    packages, depths = self._solve(use_latest=use_latest)
  File "/root/.poetry/lib/poetry/puzzle/solver.py", line 190, in _solve
    raise SolverProblemError(e)

The command '/bin/sh -c poetry install -vvv' returned a non-zero code: 1
make: *** [build-1.0.10] Error 1

Curious if anyone else is running into this. I typically use poetry on my mac, but I have some projects where I'll use it to install dependencies on centos based images like in the example project linked above.

Hope this is helpful, thank you for your consideration!

@pladdy pladdy added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jul 29, 2020
@NateScarlet
Copy link

Duplicate of #2711

@abn
Copy link
Member

abn commented Jul 29, 2020

@pladdy can you try with the latest pre-release please? As mentioned in #2711 that should fix the environment creation issue.

We should probably fail better when the venv creation fails like this. The installation should not have continued.

@pladdy
Copy link
Author

pladdy commented Jul 29, 2020

I should have searched closed issues, thanks for referencing #2711

I installed the preview version with poetry self update --preview and it worked. Thanks!

@pladdy pladdy closed this as completed Jul 29, 2020
@louwers
Copy link

louwers commented Aug 19, 2020

Can this be backported? Or can a release be made?

The lockfile does not seem to be backwards compatible.

matrey added a commit to matrey/apifetch that referenced this issue Aug 27, 2020
* poetry first run:
RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
  "program uses threads.

Need to hack into ~/.poetry/bin/poetry to change the shebang line to use Python 3 instead of Python 2...
(thanks python-poetry/poetry#1257 (comment))

* poetry second run:
NameError exception 'PosixPath' is not defined when creating virtual environment

Need to upgrade to the preview version of poetry
(thanks python-poetry/poetry#2742 (comment))

* poetry third run: installing black

Resolving dependencies... (76.5s)

(ノಠ益ಠ)ノ彡┻━┻
@abn abn removed the status/triage This issue needs to be triaged label Sep 25, 2020
Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants