galterlibrary / InvenioRDM-at-NU

Next generation repository for health science
MIT License
9 stars 0 forks source link

pkg_resources.DistributionNotFound on macOS #206

Closed fenekku closed 5 years ago

fenekku commented 5 years ago

Investigate IPython 7.0.0 bug on macOS that prevents project from being run on that platform.

Steps to reproduce: 0- Use macOS 1- PIPENV_VENV_IN_PROJECT=1 pipenv install --dev 2- pipenv run ./scripts/server Expected: 3- server to run without issue Got:

cd2h-repo-project/(96_contact_us_form)$ pipenv run ./scripts/server
Traceback (most recent call last):
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/bin/invenio", line 11, in <module>
   sys.exit(cli())
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/click/core.py", line 764, in __call__
   return self.main(*args, **kwargs)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/flask/cli.py", line 557, in main
   return super(FlaskGroup, self).main(*args, **kwargs)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/click/core.py", line 717, in main
   rv = self.invoke(ctx)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/click/core.py", line 1132, in invoke
   cmd_name, cmd, args = self.resolve_command(ctx, args)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/click/core.py", line 1171, in resolve_command
   cmd = self.get_command(ctx, cmd_name)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/flask/cli.py", line 500, in get_command
   self._load_plugin_commands()
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/flask/cli.py", line 496, in _load_plugin_commands
   self.add_command(ep.load(), ep.name)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2345, in load
   self.require(*args, **kwargs)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2368, in require
   items = working_set.resolve(reqs, env, installer, extras=self.extras)
 File "/Users/asr4267/.virtualenvs/cd2h-repo-project-qhvx1CK3/lib/python3.5/site-packages/pkg_resources/__init__.py", line 784, in resolve
   raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'appnope; sys_platform == "darwin"' distribution was not found and is required by IPython

Playing around with the IPython version boundaries might be enough. Ubuntu and other nixes have not experienced this issue (yet?).

sharpattack commented 5 years ago

@fenekku I updated the issue, as I don't believe the step included pipenv install --editable .[all] at step 1.

I think I figured what happened here though, and this will probably still happen on fresh setups. First, we know 'ipython' is listed in Pipfile, but not 'appnope'. After doing pipenv run pip freeze I could see 'ipython' installed, but not 'appnope'. So you get the above error. Next I ran a pipenv run pip install ipython, which will install 'appnope', but not add to Pipfile.lock, and then the pipenv run ./scripts/server will work.

Anyways, I suspect there is an issue with 'IPython' in the Pipfile.

fenekku commented 5 years ago

If you do your installation above and run:

pipenv run ./scripts/run-tests.sh

do all tests pass?

Also if you remove "IPython" from the Pipfile, install the project again pipenv install -e . and again run pipenv run ./scripts/run-tests.sh or even pipenv run ./scripts/server.sh what do you get? (I get some breaking tests)

sharpattack commented 5 years ago

pipenv run ./run-tests.sh will pass after pipenv run ./scripts/update

Removing 'IPython' from Pipfile, then pipenv install -e . will throw errors/fail for pipenv run ./scripts/server and pipenv run ./run-tests.sh, mostly complaining about elasticsearch version.

fenekku commented 5 years ago

Fixed by #217