chester cheetah
chester cheetah

Reputation: 83

Running setup.py install for Twisted … error ModuleNotFoundError: No module named 'twisted'

I am trying to install twisted package from the source code. I have cloned the git repository and ran python3 setup.py build but it resulted in the error ModuleNotFoundError: No module named 'twisted'. How to install the latest code? Pip install is not suitable as it has compatibility issues between Python3 and names module as mentioned in this post - Python Twisted pip package not compatible with Python3.

Upvotes: 2

Views: 792

Answers (1)

Jean-Paul Calderone
Jean-Paul Calderone

Reputation: 48315

First create a "virtualenv":

virtualenv ~/playing-around-environment

Then activate it for your current shell:

. ~/playing-around-environment

Then upgrade pip to get a version that deals with Python 2/3 distinctions better:

pip install --upgrade pip

Then install Twisted into the virtualenv:

pip install twisted

If you want to use a different version of Python, tell the virtualenv command at the beginning about it. For example:

virtualenv --python=python27 ~/playing-around-environment

or

virtualenv --python=python38 ~/playing-around-environment

python27 or python38 should give the name of a Python interpreter executable that's installed on your system. The rest of the steps remain the same.

Upvotes: 2

Related Questions