Cannot get Twisted to work on a Mac - python

I am attempting to run the source code associated with the article at https://pawelmhm.github.io/python/websockets/2016/01/02/playing-with-websockets.html, but cannot get Twisted to work. I am using macOS High Sierra 10.13.5 and Python 3.6.4 (in a virtual environment).
To create the virtual environment I used:
python3 -m venv venv
. venv/bin/activate
where python3 is my system installed python 3.6.4:
$ which python3
/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
I tried installing twisted using pip:
$ pip install twisted
Collecting twisted
Downloading https://files.pythonhosted.org/packages/12/2a/e9e4fb2e6b2f7a75577e0614926819a472934b0b85f205ba5d5d2add54d0/Twisted-18.4.0.tar.bz2 (3.0MB)
100% |████████████████████████████████| 3.0MB 1.9MB/s
Collecting zope.interface>=4.4.2 (from twisted)
Downloading https://files.pythonhosted.org/packages/ac/8a/657532df378c2cd2a1fe6b12be3b4097521570769d4852ec02c24bd3594e/zope.interface-4.5.0.tar.gz (151kB)
100% |████████████████████████████████| 153kB 281kB/s
Collecting constantly>=15.1 (from twisted)
Downloading https://files.pythonhosted.org/packages/b9/65/48c1909d0c0aeae6c10213340ce682db01b48ea900a7d9fce7a7910ff318/constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from twisted)
Downloading https://files.pythonhosted.org/packages/f5/1d/c98a587dc06e107115cf4a58b49de20b19222c83d75335a192052af4c4b7/incremental-17.5.0-py2.py3-none-any.whl
Collecting Automat>=0.3.0 (from twisted)
Downloading https://files.pythonhosted.org/packages/a3/86/14c16bb98a5a3542ed8fed5d74fb064a902de3bdd98d6584b34553353c45/Automat-0.7.0-py2.py3-none-any.whl
Collecting hyperlink>=17.1.1 (from twisted)
Downloading https://files.pythonhosted.org/packages/a7/b6/84d0c863ff81e8e7de87cff3bd8fd8f1054c227ce09af1b679a8b17a9274/hyperlink-18.0.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from zope.interface>=4.4.2->twisted) (28.8.0)
Collecting attrs>=16.1.0 (from Automat>=0.3.0->twisted)
Downloading https://files.pythonhosted.org/packages/41/59/cedf87e91ed541be7957c501a92102f9cc6363c623a7666d69d51c78ac5b/attrs-18.1.0-py2.py3-none-any.whl
Requirement already satisfied: six in /Users/sumit/Library/Python/3.6/lib/python/site-packages (from Automat>=0.3.0->twisted) (1.11.0)
Collecting idna>=2.5 (from hyperlink>=17.1.1->twisted)
Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
100% |████████████████████████████████| 61kB 2.8MB/s
Installing collected packages: zope.interface, constantly, incremental, attrs, Automat, idna, hyperlink, twisted
Running setup.py install for zope.interface ... done
Running setup.py install for twisted ... done
Successfully installed Automat-0.7.0 attrs-18.1.0 constantly-15.1.0 hyperlink-18.0.0 idna-2.7 incremental-17.5.0 twisted-18.4.0 zope.interface-4.5.0
But I keep getting the error:
$ python server.py
Traceback (most recent call last):
File "server.py", line 4, in <module>
from twisted.web.static import File
ModuleNotFoundError: No module named 'twisted'
Search on the web resulted in no useful resolution and attempts to use either easy_install or brew did not work too. Any suggestions are appreciated.

Thank you #9769953, that resolved the issue!
If anyone else searches for this issue (and for my future reference!), use:
python -m pip install twisted
I did have a virtual environment but apparently the python and pip combination was messing this up. Using python -m pip resolved the dependency issue.

Related

'ModuleNotFoundError' after installing the packages

I am using a module for a work called cryptography and tried to install it via:
C:\Users\Administrator\Desktop>python -m pip install cryptography
Here is a copy of the cmd window:
Collecting cryptography
Using cached cryptography-3.2-cp38-cp38-win32.whl (1.3 MB)
Requirement already satisfied: six>=1.4.1 in c:\users\administrator\appdata\roaming\python\python38\site-packages (from cryptography) (1.15.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\program files (x86)\python38\lib\site-packages (from cryptography) (1.14.3)
Requirement already satisfied: pycparser in c:\program files (x86)\python38\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography) (2.20)
Installing collected packages: cryptography
Successfully installed cryptography-3.2
Then when I tried using the program it just did not work:
C:\Users\Administrator\Desktop>main.py
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\ape esse\main.py", line 3, in <module>
from cryptography.fernet import Fernet
ModuleNotFoundError: No module named 'cryptography'
It gives the same error, as if not installed, and I don't know what to do.
One of my friends said it was a problem with my python installation but I've already repaired and reinstalled it and it still gives the same error.
I installed it now using
pip install cryptography --no-cache-dir and it worked perfectly fine on python 3.8.5.
so you might want to try it.

Error while installing package thats need XGBOOST

I am trying to install the "MLBox" python package on anaconda (Python 3.6).
This package needs "xgboost" so I download the wheel file from this link and I did a pip install wheel-file. I had no issue with it. But when I use the pip install for installing "mlbox" I have this error:
Collecting pandas==0.20.3 (from mlbox)
Using cached pandas-0.20.3-cp36-cp36m-win_amd64.whl
Requirement already satisfied: joblib==0.11 in c:\users\amira ayadi\anaconda3\lib\site-packages (from mlbox)
Collecting scikit-learn==0.19.0 (from mlbox)
Using cached scikit_learn-0.19.0-cp36-cp36m-win_amd64.whl
Requirement already satisfied: Theano==0.9.0 in c:\users\amira ayadi\anaconda3\lib\site-packages (from mlbox)
Collecting xgboost==0.6a2 (from mlbox)
Using cached xgboost-0.6a2.tar.gz
No files/directories in C:\Users\AMIRAA~1\AppData\Local\Temp\pip-build-6ytmh20a\xgboost\pip-egg-info (from PKG-INFO)
I also tired to install xgboost with anaconda solution (https://anaconda.org/anaconda/py-xgboost)
But same error.
Do you have some ideas?
I am on Windows 10

Installing twisted on python 3.5 and virtualenv using pip

when i run
pip install twisted
in the command line in windows, it starts installing packages until the flowing line comes up.
failed building wheel for twisted
pip then crashed soon after, saying it has failed the installation.
why is this ?
is there a way round it to install twisted?
my wheel version is 0.29, windows 10. twisted installs fine on python 2.7
thanks
I meet similar problem like yours.You can try to install the Twisted whit wheels
but at first,you should install the wheels
pip install wheels
then,download an appropriate version from this
website:http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
you can get xxxx.whl file
use
pip install xxxx/xxxxxx.whl
Finished!
Basically, that is not a programming question (I feel it might as well fit well into https://superuser.com/ or https://serverfault.com/).
Could you please provide a tad more information?
What OS are you running? What version?
For comparison, I'm running Debian GNU/Linux (testing), and
pip3 install twisted
performs fine:
collecting twisted
Using cached Twisted-17.1.0.tar.bz2
Collecting zope.interface>=4.0.2 (from twisted)
Using cached zope.interface-4.3.3.tar.gz
Collecting constantly>=15.1 (from twisted)
Downloading constantly-15.1.0-py2.py3-none-any.whl
Collecting incremental>=16.10.1 (from twisted)
Downloading incremental-16.10.1-py2.py3-none-any.whl
Collecting Automat>=0.3.0 (from twisted)
Using cached Automat-0.5.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /usr/local/lib/python3.5/dist-packages (from zope.interface>=4.0.2->twisted)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from Automat>=0.3.0->twisted)
Collecting attrs (from Automat>=0.3.0->twisted)
Using cached attrs-16.3.0-py2.py3-none-any.whl
Requirement already satisfied: packaging>=16.8 in /usr/local/lib/python3.5/dist-packages (from setuptools->zope.interface>=4.0.2->twisted)
Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python3.5/dist-packages (from setuptools->zope.interface>=4.0.2->twisted)
Requirement already satisfied: pyparsing in /usr/local/lib/python3.5/dist-packages (from packaging>=16.8->setuptools->zope.interface>=4.0.2->twisted)
Building wheels for collected packages: twisted, zope.interface
Running setup.py bdist_wheel for twisted ... done
Stored in directory: /root/.cache/pip/wheels/65/e3/44/cd3da92c03926aabc80e658e11d6e64619abce3ef44c1c34df
Running setup.py bdist_wheel for zope.interface ... done
Stored in directory: /root/.cache/pip/wheels/00/aa/8b/f1d1eb398423e59894b45ee151344e243808156c2d182c9f4e
Successfully built twisted zope.interface
Installing collected packages: zope.interface, constantly, incremental, attrs, Automat, twisted
Successfully installed Automat-0.5.0 attrs-16.3.0 constantly-15.1.0 incremental-16.10.1 twisted-17.1.0 zope.interface-4.3.3
I must admit, this install was done outside of virtualenv.
Did you try installing twisted outside your virtualenv?

Could not find a version that satisfies the requirement djangocms

Trying to follow a screencast to install DjangoCMS:
$ mkvirtualenv modern_business
$ pip install djangocms
and got an error:
I am using python 2.7. Any idea?
Looks like you need to install django cms installer:
(.envtest)$ pip install djangocms-installer
Collecting djangocms-installer
Downloading djangocms_installer-0.9.3-py2.py3-none-any.whl (57kB)
100% |████████████████████████████████| 61kB 628kB/s
Collecting argparse (from djangocms-installer)
Downloading argparse-1.4.0-py2.py3-none-any.whl
Collecting dj-database-url>=0.4 (from djangocms-installer)
Downloading dj-database-url-0.4.1.tar.gz
Successfully built dj-database-url tzlocal
.....
.....
Installing collected packages: argparse, dj-database-url, six, pytz, tzlocal, djangocms-installer
Successfully installed argparse-1.4.0 dj-database-url-0.4.1 djangocms-installer-0.9.3 pytz-2016.7 six-1.10.0 tzlocal-1.3
As per the doc here: http://docs.django-cms.org/en/release-3.4.x/introduction/install.html

Pip installation on virtual environment throwing error on versions of dependency package

We are trying to install OpenStack Services. We have created the virtual environment and installed Pip as well. Pip version is 8.1.1. Now when we try to install keystone we getting the error with dependency package as below:
/tmp/openstack-venv-builder/venvs/horizon/bin/pip install --timeout 120 --find-links /var/www/repo/os-releases/liberty --no-index --log /var/log/repo/repo_venv_builder.log keystone
Ignoring indexes: http://pypi.python.org/simple
Collecting keystone
Collecting oslo.i18n<1.6.0,>=1.5.0 (from keystone)
Could not find a version that satisfies the requirement oslo.i18n<1.6.0,>=1.5.0 (from keystone) (from versions: 3.1.0)
No matching distribution found for oslo.i18n<1.6.0,>=1.5.0 (from keystone)
Installation on oslo.i18n looks fine.
/tmp/openstack-venv-builder/venvs/horizon/bin/pip install --timeout 120 --find-links /var/www/repo/os-releases/liberty --no-index --log /var/log/repo/repo_venv_builder.log oslo.i18n
Ignoring indexes: http://pypi.python.org/simple
Collecting oslo.i18n
Collecting pbr>=1.6 (from oslo.i18n)
Collecting Babel>=1.3 (from oslo.i18n)
Collecting six>=1.9.0 (from oslo.i18n)
Collecting pytz>=0a (from Babel>=1.3->oslo.i18n)
Installing collected packages: pbr, pytz, Babel, six, oslo.i18n
Successfully installed Babel-2.1.1 oslo.i18n-3.1.0 pbr-1.8.1 pytz-2015.7 six-1.10.0
Even then we are getting error while installing keystone. Please help.

Categories