Check if a package will install in another version of Python¶
Also known as (potentially) solving the "Could not build wheels for [package]" error message.
The problem¶
Sometimes when you try to install a package you get an error. What's the error? Could be anything!
A big one is "could not build wheels for [package]," which means two things:
- The installer (
uvorpip) couldn't find a version of the package pre-built for your system (combination of your Python version + your operating system) - It tried to take the source code and turn it into a package, but something went wrong.
Figuring out the second half is probably the "correct" way to fix things long term, but changing your Python version is often a quicker fix if there happens to be a pre-built version for another.
Update uv¶
Did you install Python using uv?. I hope so, because we're going to take advantage of that!
We'll start by updating uv so it knows about recent Python releases.
Determining which other Python version to try¶
First, check the version of Python you're running:
Then, find the versions of Python that uv knows about:
Choose a stable version supported by the package you need. For the current setup guides, use Python 3.14. Avoid preview releases with a, b, or rc in their version numbers.
For example, installing JupyterLab on Python 3.15.0b1 tried to build PyYAML 6.0.3 from source and crashed with SIGSEGV. The same package installed successfully on Python 3.14 using a prebuilt package. This is one example of a build failure; other errors can have different causes.
Installing and testing¶
Since we are interested in scaling back to Python 3.14, we'll start by installing Python 3.14 with uv.
Then we'll make a temporary environment that uses Python 3.14, and turn it on.
You should see (test-3.14) at the beginning of your command line instead of (data).
Then we'll try to install the jupyterlab package in that Python 3.14 environment.
Did it work? Check that JupyterLab can start with python -m jupyterlab --version. A successful install is a good sign; try the imports or notebook code you actually need before switching your main environment.
When you're done testing, close your command line and open a new one. You'll be back to your normal (data) environment.
Switching your main environment¶
If the test worked, follow Upgrading or downgrading your Python version. Those steps save a package list, replace the old data environment, reinstall packages, and register the data kernel again.
Reinstalling packages is necessary: installing another Python does not change the interpreter in an existing environment. Reopen Jupyter or VS Code and select data, then check sys.executable in a notebook to confirm the path.
After returning to your normal environment, you can remove the temporary test environment:
This removes the test environment and its installed packages, so keep notebooks and project files outside that folder.