Installing Brownie With The New Python 3.11 Version
How to Get Rid of Cython Incompatibility Errors
It is an unfortunate fact that in the world of software development, the latest build, version, or release is not always the best version due to incompatibility issues between dependencies or other security challenges. This comes into effect when attempting to install eth-brownie using the early Python 3.11 versions.
This article outlines a few steps I took to resolve the issue. Note however that I threw a lot at the wall and I’m not certain what exactly finally worked. Likely errors generated include:
- Cannot open include file: ‘longintrepr.h’: No such file or directory
- pip failed to build packages: bitarray cytoolz yarl iru-dict multidict psutil regex
- Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”
- command ‘C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe’ failed with exit code 2
STEPS
These errors are generated due to an incompatibility between Python 3.11 and Cython. While it will most likely get fixed in later builds, downgrading to an earlier Python version usually does the trick. Here are a few steps I would recommend. You must already have ganache and ganache-cli installed.
- Install Python 3.10 or lower. This can run concurrently with your current Python version, but you need to change the priority version in PATH, use a virtual environment, or directly call it in the shell using
py -3.10
. - Uninstall pipx (run
pip uninstall pipx
) and reinstall it using the lower Python versionpy -3.10 -m pip install --user pipx
. You might need to clean up earlier attempts to install brownie by deleting the eth-brownie folder under users/your-username/.local/pipx/venvs. Also, remember to callpipx ensurepath
after reinstallation - Uninstall Cython (run
pip uninstall cython
) and reinstall it using the lower Python version (runpip install cython
). - Reattempt installing eth-brownie
pipx install eth-brownie
.
If brownie installation still doesn’t work, try one or both of the following:
- Forget pipx altogether and
pip install brownie
instead. - Download the Visual Studio Build tools 2019, and install all the dependencies.
This post will be edited once a new build is introduced that solves the issue without the need for workarounds. In the meantime, hope this helps!
New to trading? Try crypto trading bots or copy trading on best crypto exchanges
Join Coinmonks Telegram Channel and Youtube Channel get daily Crypto News