ERROR: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects
Asked Answered
H

2

7

I am unable to use Jupyter notebooks on VS Code within a virtual environment, due to a problem with installing ipykernel. When I switch to the global environment, ipykernel installs fine and I can run my notebooks.

If I make a new folder, enter it, run python3 -m venv venv, then source venv/bin/activate, followed by code ., then make a .ipynb file and try to execute any code in a new cell, then VS Code prompts me to install ipykernel. So I do that, and VS Code displays this:

Running cells with 'Python 3.8.9 ('venv': venv)' requires ipykernel package.
Run the following command to install 'ipykernel' into the Python environment. 
Command: '/Users/my.name/Documents/test/venv/bin/python -m pip install ipykernel -U --force-reinstall'

So I pip install ipykernel, and it throws this error at me:

ERROR: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects

I am running macOS 12.5.1 on a MacBook M1 Pro. Visual Studio Code version 1.71.0. My virtual environment is on Python 3.8.9.

What steps can be taken to resolve this?

Some other parts of the error that look useful:

Building wheels for collected packages: pyzmq
  Building wheel for pyzmq (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pyzmq (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [174 lines of output]

      Loads of lines saying "copying something -> somewhere" which I've edited out

      buildutils/initlibzmq.cpp:10:10: fatal error: 'Python.h' file not found
      #include "Python.h"
               ^~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang++' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyzmq
Failed to build pyzmq
ERROR: Could not build wheels for pyzmq, which is required to install pyproject.toml-based projects
Holily answered 8/9, 2022 at 17:14 Comment(2)
In my case, the issue was the pyzmq version. Previously, I had Python3.8, and the issue arose when I switched to Python3.9. So, I specified the latest version of pyzmq, and it was good.Cupellation
@MuhammadZubair Thanks for that tip. Worked a treat for me, too!Ulla
M
-1

Try install pyproject-toml==0.0.10 The last version not working...👍 After pip install pyzmq All okenter image description here

Massey answered 29/10, 2023 at 20:21 Comment(2)
You should never need to install pyproject-toml. It's an ancient draft project. In addition, pyproject-toml==0.0.10 is the latest version of that project.Surveyor
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Pachydermatous
S
-1

I solved this issue, by install XCode on my macbook laptop (M1)

Sst answered 8/1 at 5:21 Comment(1)
As you are not providing a concrete answer and rather suggesting something, this should be a comment. Once you earn enough reputation, you'll be able to comment everywhereIrradiation

© 2022 - 2024 — McMap. All rights reserved.