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:
pipcouldn'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:
Scroll all the way up to the top to see something that looks a little bit earlier than yours.
For example, if I'm using Python 3.13 I might want to dial back to Python 3.12.
Installing and testing¶
Since we are interested in scaling back to Python 3.12, we'll start by installing Python 3.12 with uv.
Then we'll make a temporary environment that uses Python 3.12, and turn it on.
You should see (test-3.12) at the beginning of your command line instead of (data).
Then we'll try to install the dedupe package in that Python 3.12 environment.
Did it work? Great, now we know Python 3.12 is the answer!
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 you decide you want to use Python 3.12 for everything, you can rebuild your data environment with the older Python. This deletes everything you've installed, so you'll need to reinstall your packages afterwards.
Then close your command line, open a new one, and reinstall what you need:
Your data kernel in Jupyter and VS Code will automatically use the new Python, since it's living in the same place as the old one.
To get rid of the test environment, you can delete it: