sblunt/orbitize

During clean install run into: ModuleNotFoundError: No module named 'numpy'

jsnguyen opened this issue · 2 comments

Issue

Using a clean environment on Python 3.11.4, running

pip install orbitize

Produces the following error:

Obtaining file:///home/jsn/landing/programs/orbitize
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... error
  error: subprocess-exited-with-error

  × Getting requirements to build editable did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      Traceback (most recent call last):
        File "/home/jsn/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/jsn/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/jsn/.pyenv/versions/3.11.2/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 132, in get_requires_for_build_editable
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ip4a3a1v/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 468, in get_requires_for_build_editable
          return self.get_requires_for_build_wheel(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ip4a3a1v/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ip4a3a1v/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-ip4a3a1v/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 507, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-ip4a3a1v/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 2, in <module>
      ModuleNotFoundError: No module named 'numpy'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip

Running pip install numpy does not help the problem. I was able to reproduce this on 2 different machines with and without virtual environments. I'm also using pyenv to manage Python versions, but I have confirmed that pip is installing packages to where they should be.

Solution

The solution I came up with was running:

pip install wheel

Then

pip install orbitize

seems to work.

Adding wheel to the requirements.txt does not fix the problem, you have to run pip install wheel separately.

Might be helpful to include this in the docs since it fails on a clean virtual environment. Not sure if there's a better way to fix this, might also be an issue with newer Python versions.

sblunt commented

Thanks for the bug report @jsnguyen! I'll add this to our docs.

sblunt commented

Documentation added in 4ee8274