Installing Brownie With The New Python 3.11 Version

How to Get Rid of Cython Incompatibility Errors

Peter M. Ogwara
Coinmonks
Published in
2 min readMar 18, 2023

--

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:

  1. Cannot open include file: ‘longintrepr.h’: No such file or directory
  2. pip failed to build packages: bitarray cytoolz yarl iru-dict multidict psutil regex
  3. Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”
  4. 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.

  1. 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.
  2. Uninstall pipx (run pip uninstall pipx) and reinstall it using the lower Python version py -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 call pipx ensurepath after reinstallation
  3. Uninstall Cython (run pip uninstall cython) and reinstall it using the lower Python version (run pip install cython).
  4. Reattempt installing eth-brownie pipx install eth-brownie.

If brownie installation still doesn’t work, try one or both of the following:

  1. Forget pipx altogether and pip install brownie instead.
  2. 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

Also, Read

--

--

Peter M. Ogwara
Coinmonks

Academic Writer, Full-Stack Web Developer, Web3 Enthusiast