Stefano Zimmitti
Stefano Zimmitti

Reputation: 51

Installing PyQT in conda environment

The final goal was to have a working environment with: Tensorflow, numpy, pandas, pyqt5, psycopg2. I successfully installed TF, numpy and pandas but not pyqt5. That's what I did:

  1. Installed X-Code command tools
  2. Installed miniforge
  3. installed Tensorflow via pip:

pip install --upgrade --force --no-dependencies https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl. 4. Installed pandas and numpy. 5. TRIED to install pyqt5 via conda install with: (1)conda install --name new_env pyqt5

(2)conda install --name new_env -c conda-forge pyqt5

(3)pip install pyqt

(4)pip install pyqt5

But none of that worked out. For commands (1) and (2) came out:

"PackagesNotFoundError: The following packages are not available from current channels:

  • pyqt

Current channels:

While for (4) command:

ERROR: Could not find a version that satisfies the requirement pyqt (from versions: none) ERROR: No matching distribution found for pyqt

and (5):

ERROR: Command errored out with exit status 1:
     command: /Users/stefanozimmitti/miniforge3/envs/new_env/bin/python3.8 /Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/tmpmwnbekdr
         cwd: /private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-install-cp4t3jsy/pyqt5
    Complete output (31 lines):
    Traceback (most recent call last):
      File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 126, 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/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
        main()
      File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 130, in prepare_metadata_for_build_wheel
        return _get_wheel_metadata_from_wheel(backend, metadata_directory,
      File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
      File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
        project = AbstractProject.bootstrap('pep517')
      File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 481, in setup
        self.apply_user_defaults(tool)
      File "project.py", line 63, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 227, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
        raise PyProjectOptionException('qmake',
    sipbuild.pyproject.PyProjectOptionException
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/stefanozimmitti/miniforge3/envs/new_env/bin/python3.8 /Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/tmpmwnbekdr Check the logs for full command output.

I tried to be as specific as possible, my final goal was having a working version of Tensorflow on my Mac M1, along with a couple more packages like pandas, numpy, PyQT5 and psycopg2. I succeded to install Tensorflow, pandas and numpy, need help on PyQt5

Upvotes: 2

Views: 33608

Answers (3)

resurrected user
resurrected user

Reputation: 492

Do not try to install "PyQt5" but just "PyQt". Add the version if necessary, but at the moment of writing 5 is still current.

Upvotes: 0

SamC
SamC

Reputation: 96

I think this should work for the installation of PyQt5.

conda config --add channels conda-forge
conda config --set channel_priority strict
conda install pyqt

This should be done prior to using pip, as stated here.

Upvotes: 3

Pablo Sili&#243;
Pablo Sili&#243;

Reputation: 312

Try with

conda update --all
conda install qt
conda install pyqt

Upvotes: 0

Related Questions