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

Advice for M1 mac installation #83

Open
swilson27 opened this issue Feb 28, 2022 · 8 comments
Open

Advice for M1 mac installation #83

swilson27 opened this issue Feb 28, 2022 · 8 comments

Comments

@swilson27
Copy link

There are difficulties with installing navis on an M1 mac, with PyQt5 appearing to be the root. Running pip3 install navis in the terminal raiss the following error:

error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [25 lines of output]
Querying qmake about your Qt installation...
/opt/homebrew/bin/qmake -query
Traceback (most recent call last):
File "/Users/swilson/documents/devneurons/devenv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "/Users/swilson/documents/devneurons/devenv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/Users/swilson/documents/devneurons/devenv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/Users/swilson/documents/devneurons/devenv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
      whl_basename = backend.build_wheel(metadata_directory, config_settings)
    File "/private/var/folders/5h/ftvtllls0nj2xjm5r7fwj9qh0000gp/T/pip-build-env-da71a4tm/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 51, in build_wheel
      project = AbstractProject.bootstrap('pep517')
    File "/private/var/folders/5h/ftvtllls0nj2xjm5r7fwj9qh0000gp/T/pip-build-env-da71a4tm/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
      project.setup(pyproject, tool, tool_description)
    File "/private/var/folders/5h/ftvtllls0nj2xjm5r7fwj9qh0000gp/T/pip-build-env-da71a4tm/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 610, in setup
      self.update(tool)
    File "/private/var/folders/5h/ftvtllls0nj2xjm5r7fwj9qh0000gp/T/pip-install-8r7dfzxu/pyqt5_31dd0b8a97e242c3bb9e37bb5de28680/project.py", line 160, in update
      raise UserException(
  sipbuild.exceptions.UserException
  [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

Note that this applies for python 3.8, .9 and .10. I previously managed to get this working, so there is definitely a means, but stupidly didn't note down which fix online worked. If anyone has any insights or has succeeded with installing navis on M1 recently, please do let me know

@schlegelp
Copy link
Collaborator

@dokato: any thoughts on that?

@swilson27: technically navis doesn't actually need pyqt5 anymore. It's only there as a backend for vispy which we use for 3D plotting from the terminal. What you could do is this:

  1. Install navis without dependencies: pip3 install navis --no-deps
  2. Install dependencies manually skipping pyqt5: pip3 install h5py>=3.1 matplotlib>=3.3 morphops>=0.1.11 ncollpyde>=0.18 networkx>=2.4 numpy>=1.16 pandas>=1.0 pint>=0.10 plotly>=4.9 pynrrd>=0.4.2 pypng>=0.0.18 requests>=2.20 seaborn>=0.10 setuptools>=50.6 scipy>=1.5 six>=1.11 tqdm>=4.45 typing-extensions>=3.7.4 trimesh>=3.8 vispy>=0.6.4 fuzzywuzzy>=0.18 molesq>=0.2.0 rdata>=0.5 skeletor>=1.0.0

Let me know if you run into any issues.

@clbarnes
Copy link
Collaborator

clbarnes commented Mar 1, 2022

Could pyqt5 be moved into an optional dependency? I regularly have installation issues with it on x86 too.

@dokato
Copy link
Contributor

dokato commented Mar 1, 2022

I'm on Mac M1 and used to have much more problems with pyqt in the past. Recently, I succeeded with creating a conda environment like this:

conda install -c andfoy pyqt
conda install pandas numpy matplotlib scipy h5py
conda install -c anaconda scikit-learn scikit-image 
pip install git+git://github.com/schlegelp/clio-py@main 
conda install -c flyem-forge neuprint-python
pip install --verbose git+https://github.com/navis-org/navis

(some packages can be probably skipped, leaving for completeness, just in case)

@schlegelp
Copy link
Collaborator

schlegelp commented Mar 1, 2022

Could pyqt5 be moved into an optional dependency? I regularly have installation issues with it on x86 too.

I was thinking about that too but just tried uninstalling my PyQt5 and then matplotlib.pyplot fails to import.

@schlegelp
Copy link
Collaborator

Hi @swilson27. Has any of the above helped you to install navis?

@clbarnes
Copy link
Collaborator

clbarnes commented Mar 15, 2022

2. Install dependencies manually skipping pyqt5: `a long pip command`

In case it's useful for anyone else, a cheat code for this which will stay up to date with master is

wget -O - https://raw.githubusercontent.com/navis-org/navis/master/requirements.txt \
    | grep -v 'PyQt' \
    | pip install -r /dev/stdin

It'll also install the dev reqs, but that shouldn't be too much of a problem.

@clbarnes
Copy link
Collaborator

If pyqt5 is only used as a vispy backend, should we just use a different backend? Both pyqt6 and pyside6 have macos-universal2 wheels for py3.6+.

clbarnes added a commit that referenced this issue Mar 31, 2022
PyQt5 causes installation issues on M1 macs (see issue #83).
PyQt is not used explicitly; only as a backend for vispy.

PyQt6 does not seem to have such issues on M1, and selecting it
as a vispy extra rather than a direct dependency should be more robust.
@clbarnes
Copy link
Collaborator

Progress: on master, no backend is installed if you just pip install navis - so more people can get most of navis' functionality without issue. You still need a backend if you want to do 3D plotting with vispy, and each of the available options are navis extras, e.g. pip install 'navis[vispy-pyside6]'. Which one works for you will be platform-dependent. The all extra includes vispy-default, which is currently pyside6, which seems to work from ipython terminals on most platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants