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 "couldnot build wheels for [package]," which means two things:
pip
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 pyenv¶
Did you install Python using pyenv?. I hope so, because we're going to take advantage of that!
We'll start by updating all of the Pythons that pyenv knows about.
How did you install pyenv? Don't worry if you aren't sure: running both methods won't cause any problems.
Determining which other Python version to try¶
First,check the version of Python you're running:
Then, find the versions of Python that pyenv 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 3.11.8
I might want to dial back to 3.10.13
.
Installing and testing¶
Since we are interested in scaling back to Python 3.10.13, we'll start by installing Python 3.10.13 with pyenv.
Then we'll try to install the dedupe
package just for Python 3.10.13.
Did it work? If so, you might want to change your version permanently to that other version of Python.
Cleanup¶
If you change the version of Python you're using, you'll probably end up having to reinstall a lot of packages for your new Python version, along with setting up Jupyter to point to the right place.