Installing twisted on python 3.5 and virtualenv using pip - python

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?

Related

ERROR: Could not build wheels for bcrypt which use PEP 517 and cannot be installed directly

The interpreter configuration in pycharm became invalid for some reason so I created a new virtual environment for the project that I was working on, and installed the dependencies again. But I am having trouble in installing bcrypt again. Here's the complete error. The project was working fine with the previous interpreter so I doubt that the python version has anything to do with it. I tried installing wheel as well as the error said could not build wheels but that didn't do the job as well.
The complete error:
Collecting flask-bcrypt
Using cached https://files.pythonhosted.org/packages/1d/c0/6d4c04d007d72b355de24e7a223978d1a95732245f
9e9becbf45d3024bf8/Flask-Bcrypt-0.7.1.tar.gz
Requirement already satisfied: Flask in c:\users\User\appdata\local\programs\python\python38-3
2\lib\site-packages (from flask-bcrypt) (1.1.2)
Collecting bcrypt (from flask-bcrypt)
Using cached https://files.pythonhosted.org/packages/d8/ba/21c475ead997ee21502d30f76fd93ad8d5858d19a3
fad7cd153de698c4dd/bcrypt-3.2.0.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: Jinja2>=2.10.1 in c:\users\User\appdata\local\programs\python\p
ython38-32\lib\site-packages (from Flask->flask-bcrypt) (2.11.2)
Requirement already satisfied: Werkzeug>=0.15 in c:\users\User\appdata\local\programs\python\p
ython38-32\lib\site-packages (from Flask->flask-bcrypt) (1.0.1)
Requirement already satisfied: itsdangerous>=0.24 in c:\users\User\appdata\local\programs\pyth
on\python38-32\lib\site-packages (from Flask->flask-bcrypt) (1.1.0)
Requirement already satisfied: click>=5.1 in c:\users\User\appdata\local\programs\python\pytho
n38-32\lib\site-packages (from Flask->flask-bcrypt) (7.1.2)
Requirement already satisfied: six>=1.4.1 in c:\users\User\appdata\roaming\python\python38\sit
e-packages (from bcrypt->flask-bcrypt) (1.15.0)
Requirement already satisfied: cffi>=1.1 in c:\users\User\appdata\local\programs\python\python
38-32\lib\site-packages (from bcrypt->flask-bcrypt) (1.14.2)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\User\appdata\local\programs\python
\python38-32\lib\site-packages (from Jinja2>=2.10.1->Flask->flask-bcrypt) (1.1.1)
Requirement already satisfied: pycparser in c:\users\User\appdata\local\programs\python\python
38-32\lib\site-packages (from cffi>=1.1->bcrypt->flask-bcrypt) (2.20)
Building wheels for collected packages: bcrypt
Building wheel for bcrypt (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\User\appdata\local\programs\python\python38-32\python.exe' 'c:\users\User\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\pep517\_in_process.p
y' build_wheel 'C:\conda_temp\tmpgl0zt2ul'
cwd: C:\conda_temp\pip-install-9i9ne9yb\bcrypt
Complete output (15 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\bcrypt
copying src\bcrypt\__about__.py -> build\lib.win32-3.8\bcrypt
copying src\bcrypt\__init__.py -> build\lib.win32-3.8\bcrypt
copying src\bcrypt\py.typed -> build\lib.win32-3.8\bcrypt
running build_ext
generating cffi module 'build\\temp.win32-3.8\\Release\\_bcrypt.c'
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
building '_bcrypt' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://vi
sualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Failed building wheel for bcrypt
Running setup.py clean for bcrypt
Failed to build bcrypt
ERROR: Could not build wheels for bcrypt which use PEP 517 and cannot be installed directly
WARNING: You are using pip version 19.2.3, however version 20.2.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
try using these commands:
python -m pip install --upgrade pip
python -m pip install --no-use-pep517 bcrypt
What I did might work for you also:
$ python -m pip install --no-use-pep517 bcrypt
$ python -m pip install --upgrade pip
and it worked.
bcrypt is now implemented in Rust. Users building from source will need to have a Rust compiler available although nothing will change for users downloading wheels.
bcrypt developers no longer ship manylinux2010 wheels. Users should upgrade to the latest pip to ensure this doesn’t cause issues downloading wheels on their platform or use an older version than 4.0.0.
So try
pip3 install -U "bcrypt<4.0.0"
Fixing bcrypt to 3.2.2 (the latest version before 4.0.0) fixed this for me. Like stated here:
The problem comes with bcrypt 4.0.0 for which there is no wheel available.
Changing python from 32-version to 64-version may be solution. It helped me.
I downloaded and installed
"microsoft visual c++ build tools"
https://go.microsoft.com/fwlink/?LinkId=691126
and restarted the computer and worked for me.
try
pip install pep517
PIP is very unreliable, it needs over 350 different packages under python, and the system as well

Cannot get Twisted to work on a Mac

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.

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

How to uninstall dependencies introduced by a Python package installed with Pip?

I tried to install PyLint. When installing I saw the following:
Collecting pylint
Downloading pylint-1.6.5-py2.py3-none-any.whl (577kB)
100% |████████████████████████████████| 583kB 655kB/s
Collecting six (from pylint)
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting isort>=4.2.5 (from pylint)
Downloading isort-4.2.5-py2.py3-none-any.whl (40kB)
100% |████████████████████████████████| 40kB 737kB/s
Collecting mccabe (from pylint)
Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting configparser; python_version == "2.7" (from pylint)
Downloading configparser-3.5.0.tar.gz
Collecting backports.functools-lru-cache; python_version == "2.7" (from pylint)
Downloading backports.functools_lru_cache-1.3-py2.py3-none-any.whl
Collecting astroid<1.5.0,>=1.4.5 (from pylint)
Downloading astroid-1.4.9-py2.py3-none-any.whl (213kB)
100% |████████████████████████████████| 215kB 713kB/s
Collecting lazy-object-proxy (from astroid<1.5.0,>=1.4.5->pylint)
Downloading lazy-object-proxy-1.2.2.tar.gz
Collecting wrapt (from astroid<1.5.0,>=1.4.5->pylint)
Downloading wrapt-1.10.8.tar.gz
Building wheels for collected packages: configparser, lazy-object-proxy, wrapt
Running setup.py bdist_wheel for configparser ... done
Stored in directory: /Users/dkanesha/Library/Caches/pip/wheels/1c/bd/b4/277af3f6c40645661b4cd1c21df26aca0f2e1e9714a1d4cda8
Running setup.py bdist_wheel for lazy-object-proxy ... done
Stored in directory: /Users/dkanesha/Library/Caches/pip/wheels/06/d4/af/71508d0c69292f8c369ba3ae83cd85fabcd6956fd5709633b4
Running setup.py bdist_wheel for wrapt ... done
Stored in directory: /Users/dkanesha/Library/Caches/pip/wheels/19/8a/01/20cf74c3f38d49ef8e9b9aa7ffd38cefff79bad9f6f2c651f0
Successfully built configparser lazy-object-proxy wrapt
Installing collected packages: six, isort, mccabe, configparser, backports.functools-lru-cache, lazy-object-proxy, wrapt, astroid, pylint
Successfully installed astroid-1.4.9 backports.functools-lru-cache-1.3 configparser-3.5.0 isort-4.2.5 lazy-object-proxy-1.2.2 mccabe-0.6.1 pylint-1.6.5 six-1.10.0 wrapt-1.10.8
Can I uninstall the packages mentioned here Installing collected packages: six, isort, mccabe, configparser, backports.functools-lru-cache, lazy-object-proxy, wrapt, astroid, pylint to restore to the previous state, or could the "Installing collected packages" refer to packages previously installed too?
There are two useful packages to deal with it.
Use the package pip-autoremove to uninstall package and its dependencies. You can also use pipdeptree to display a tree relationship of all installed packages.
pip will pretty explicitly tell you what exactly it does. If required packages are already installed, they won't be listed in the "successfully installed" list and it will say "requirement already satisfied" instead. If a dependency was upgraded during the installation, it will explicitly say that it found a previous version, that it uninstalled the previous version and that it installed a new version.
So, yes, in your case it does not look like it upgraded any old packages and purely installed new packages, so uninstalling all those should revert you to your previous state.

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