Poetry: No module named 'pkg_resources' in json_schema - new osx install

Created on 22 Jan 2019  路  7Comments  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: OSX 10.14.2

  • Poetry version: 0.12.11
  • pyproject.toml created by init, no packages added

Issue

  1. OS-X with macports & py2.7/3.6/3.7 installed (plus the various pips)
  2. Installed poetry as recommended (using /opt/local/bin/python3.6 as the interpreter)
  3. Added poetry to path
  4. Nearly all commands crash the same way
$ poetry version -vvv
$ poetry debug:info -vvv
$ poetry add requests -vvv

All generate the same output:
------

[ModuleNotFoundError]
No module named 'pkg_resources'

Exception trace:
 /Users/andrew/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /Users/andrew/.poetry/lib/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /Users/andrew/.poetry/lib/poetry/_vendor/py3.6/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /Users/andrew/.poetry/lib/poetry/console/commands/command.py in run() at line 77
   return super(BaseCommand, self).run(i, o)
 /Users/andrew/.poetry/lib/poetry/_vendor/py3.6/cleo/commands/base_command.py in run() at line 136
   self.initialize(input_, output_)
 /Users/andrew/.poetry/lib/poetry/console/commands/env_command.py in initialize() at line 18
   current_env = Env.get(self.poetry.file.parent)
 /Users/andrew/.poetry/lib/poetry/console/commands/command.py in poetry() at line 62
   return self.get_application().poetry
 /Users/andrew/.poetry/lib/poetry/console/application.py in poetry() at line 55
   from poetry.poetry import Poetry
 /Users/andrew/.poetry/lib/poetry/poetry.py in <module>() at line 11
   from .json import validate_object
 /Users/andrew/.poetry/lib/poetry/json/__init__.py in <module>() at line 4
   import jsonschema
 /Users/andrew/.poetry/lib/poetry/_vendor/py3.6/jsonschema/__init__.py in <module>() at line 32
   from pkg_resources import get_distribution

debug:info
stale

Most helpful comment

Installed pip & setuptools on my p3.7 interpreter, and it works now.

Is this an issue with poetry's installer? Is it by design?

It does rely on my local python for at least one system package (setuptools), which is 馃憥 . I would think that one could be vendor'd as well.

get-poetry.py:

This ensure that poetry will look for its dependencies inside the _vendor directory without tampering with the base system.

Consider my system tampered 馃ぃ Not a huge deal, for one person, but for the whole team and their varying configs... not sure yet.

I had no pip installed for py3.6 and py3.7 because I shouldn't and don't need them. Having them is confusing :(

I'll try a project, and give poetry to a coworker, but if he runs into any issues i"ll just call it off. So much promise... really, if poetry can fully vendor everything and run on its own internal python rather than #!/usr/bin/env python it would be great!

All 7 comments

Can anyone help with this? I'd really like to not use Pipenv, but difficult when step 1 "get poetry installed" is difficult (and the fact that googling this helps not at all).

The preview version 1.0.0a2 also has the exact same exception in jsonschema as well.

I've tried reinstalling using all local interpreters (2.7.15, 3.6, 3.7), all show the same exact same traceback. However, I get a long fine with pipenv, python3.6 -m venv, and all the variations.

Installed pip & setuptools on my p3.7 interpreter, and it works now.

Is this an issue with poetry's installer? Is it by design?

It does rely on my local python for at least one system package (setuptools), which is 馃憥 . I would think that one could be vendor'd as well.

get-poetry.py:

This ensure that poetry will look for its dependencies inside the _vendor directory without tampering with the base system.

Consider my system tampered 馃ぃ Not a huge deal, for one person, but for the whole team and their varying configs... not sure yet.

I had no pip installed for py3.6 and py3.7 because I shouldn't and don't need them. Having them is confusing :(

I'll try a project, and give poetry to a coworker, but if he runs into any issues i"ll just call it off. So much promise... really, if poetry can fully vendor everything and run on its own internal python rather than #!/usr/bin/env python it would be great!

@awbacker I'm pretty sure pipenv also requires you to have pip installed, so I don't think using pipenv will solve this issue for you: https://pipenv.readthedocs.io/en/latest/install/#make-sure-you-ve-got-python-pip

Both solutions are just wrappers around pip...

Another reason the pkg_resource error occurs is when you're running the wrong Python.
I had Python 3.7.3 altinstalled and an alias of python=/path.../bin/python3.7.3.
However /usr/bin/env still found the system Python 2.7.

This became obvious when doing the poetry version -vvv command above and seeing poetry was in _vendor/py2.7/ and not _vendor/py3.7/.

Ended up installing pyenv and activating 3.7.3 for the project.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.

Was this page helpful?
0 / 5 - 0 ratings