I just tried to install Plotly using pip. I am running python from Anaconda and now anytime I attempt to run anything python I get the following errors and I have no idea how to fix it. I am running on Windows 7 64bit, Python3,4
PS Z:\> pip
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\pip-script.py", line 3, in <module>
from pip import main
File "C:\Anaconda3\lib\site-packages\pip\__init__.py", line 11, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:\Anaconda3\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "C:\Anaconda3\lib\site-packages\pip\download.py", line 22, in <module>
from pip._vendor import requests, six
File "C:\Anaconda3\lib\site-packages\pip\_vendor\requests\__init__.py", line 58, in <module>
from . import utils
File "C:\Anaconda3\lib\site-packages\pip\_vendor\requests\utils.py", line 25, in <module>
from .compat import parse_http_list as _parse_list_header
File "C:\Anaconda3\lib\site-packages\pip\_vendor\requests\compat.py", line 77, in <module>
import simplejson as json
File "C:\Anaconda3\lib\site-packages\simplejson\__init__.py", line 112, in <module>
from .scanner import JSONDecodeError
File "C:\Anaconda3\lib\site-packages\simplejson\scanner.py", line 10, in <module>
c_make_scanner = _import_c_make_scanner()
File "C:\Anaconda3\lib\site-packages\simplejson\scanner.py", line 6, in _import_c_make_scanner
from simplejson._speedups import make_scanner
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 4: invalid start byte
PS Z:\>
This is an interaction between Anaconda's version of pip and the latest version of simplejson (which was installed when you installed Plotly).
As a workaround,
del C:\Anaconda3\lib\site-packages\simplejson
This will allow pip and Plotly to work again. Unfortunately if you ever upgrade Plotly this problem will happen again, so we will add a workaround to the Plotly requirements.txt file that prevents this from happening in future. (Plotly only actually needs simplejson on Python 2.6 systems.)
There was an Anaconda issue open related to this that I've commented on: https://github.com/ContinuumIO/anaconda-issues/issues/238
Plotly Python API issue re: finding a workaround so this doesn't happen again (or to other users): https://github.com/plotly/python-api/issues/197
As of version 1.6.10 for the plotly package, the simplejson and ordereddict packages are no longer dependencies.
TL;DR:
Python 2.6 should use:
pip install plotly[PY2.6]
While Python 2.7, 3.3, and 3.4 should still use:
pip install plotly
More Info:
If you're already hitting the issue in this post, you'll likely need to remove the simplejson package as discussed in answer scjody gave.
The simplejson and ordereddict packages were there to have common dependencies for Python 2.6 through Python 3.4. However, since simplejson clashes with anaconda, we now have an "extras" option for the pip install.
As usual, because the version of IPython we depend on doesn't support Python 2.6, there are still two optional requirements files which install matplotlib, IPython[notebook], etc.
optional_requirements.txt
optional_requirements-2-6.txt
Quotes Notes:
Depending on the shell you're using, you may need to wrap the install target in quotes ('') when using the extras for Python 2.6:
pip install 'plotly[PY2.6]'
Related
I'm using virtualenvwrapper. Under my virtualenv with python3, I installed futures successfully, then if I install anything else, it will pop up syntax errors which comes from futures package
errors are as follows:
$ pip install futures
Collecting futures
Installing collected packages: futures
Successfully installed futures-3.1.1
$ pip install sklearn
Traceback (most recent call last):
File "/data/analytics/yliu/.virtualenvs/alice1/bin/pip", line 7, in <module>
from pip._internal import main
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
from pip._internal.commands import (
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/commands/__init__.py", line 6, in <module>
from pip._internal.commands.completion import CompletionCommand
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/commands/completion.py", line 6, in <module>
from pip._internal.cli.base_command import Command
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 24, in <module>
from pip._internal.index import PackageFinder
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/index.py", line 41, in <module>
from pip._internal.wheel import Wheel
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/pip/_internal/wheel.py", line 7, in <module>
import compileall
File "/usr/local/anaconda3/anaconda/lib/python3.6/compileall.py", line 20, in <module>
from concurrent.futures import ProcessPoolExecutor
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/data/analytics/yliu/.virtualenvs/alice1/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
I checked the answer in this question: pip install error within Python 3 virtualenv, but it doesn't work for me. The futures package is indeed installed in the right version of python which is python 3.6.5.
I tried to install futures on python3.6 globally and everything works fine. so it seems something with the futures and the virtualenv.
Can anyone please help me solve this issue?
Thanks so much
I got this issue because there's a python3 package's requirement includes futures.
If you're short on time you can downgrade setuptools to 45.2.0 to bypass it.
futures package at PyPI is a backport of the concurrent.futures standard library module to Python 2.
To use futures in Python 3 you don't need to install anything, it's a standard library module.
Now your virtualenv contains a broken Python 2 module. I recommend to remove the virtualenv and recreate it.
I have been trying to get pip with python3 on WSL ubuntu 16.04 and have had no success. I have been running sudo apt install --reinstall python3-pip, but still have issues getting pip to work properly.
$ pip3
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 14, in
<module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in
<module>
from pip.locations import (
File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in
<module>
from distutils import sysconfig
ImportError: No module named 'distutils'
Similar with sudo
$ sudo pip3
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 14, in
<module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 23, in
<module>
from pip.locations import (
File "/usr/lib/python3/dist-packages/pip/locations.py", line 9, in <module>
from distutils import sysconfig
ImportError: No module named 'distutils'
Also I noticed that I seem to have two versions of python3 installed:
$ ls /usr/lib | grep python
python2.7
python3
python3.5
According to Python 3 documentation, distutils apparently is not deprecated, BUT, my install of 2.7 has disutils, but 3.6 does not.
When I read:
https://docs.python.org/3/installing/
It seemed to say that distutils was being deprecated, but it was not worded clearly if they were talking about distutils or something else.
If anyone knows the definitive answer, please let us know.
So after a lot of pain, I finally gave in. I had made things worse and corrupted my entire python3 installation. I had corrupted too many files trying to fix everything. I ended up uninstalling WSL/ubuntu and reinstalling clean. I made of backup a few things first.
Unfortunately, this seems to be the best option if you have really messed this up, like I did. Being more careful now, python3 is working just fine, with pip. Make sure you follow official docs when you install.
trying to run a pymodbus tcp server and im getting this stack trace... at a total loss here so any help is appreciated. Thanks!
Traceback (most recent call last):
File "Worrking_ModbusJ1939Bridge.py", line 12, in <module>
from pymodbus.server.async import StartTcpServer
File "build/bdist.linux-armv7l/egg/pymodbus/server/async.py", line 18, in <module>
File "build/bdist.linux-armv7l/egg/pymodbus/internal/ptwisted.py", line 5, in <module>
File "/usr/local/lib/python2.7/dist-packages/twisted/conch/manhole_ssh.py", line 14, in <module>
from twisted.conch.ssh import factory, session
File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/factory.py", line 18, in <module>
from twisted.conch.ssh import (_kex, transport, userauth, connection)
File "/usr/local/lib/python2.7/dist packages/twisted/conch/ssh/transport.py", line 345, in <module>
class SSHTransportBase(protocol.Protocol):
File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/transport.py", line 469, in SSHTransportBase
supportedCiphers = _getSupportedCiphers()
File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/transport.py", line 335, in _getSupportedCiphers
backend=default_backend(),
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/__init__.py", line 15, in default_backend
from cryptography.hazmat.backends.openssl.backend import backend
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
from cryptography.hazmat.backends.openssl.backend import backend
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/backend.py", line 16, in <module>
from cryptography import utils, x509
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 7, in <module>
from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency
I was using pip 7 and got the same problem. Upgrading to pip 9 solved it. I'm not sure about the cause.
Via: https://github.com/micheloosterhof/cowrie/issues/618
I've been hitting this while attempting to update Python Cryptography for Solaris 11.4, using the https://github.com/oracle/solaris-userland/ build system. A "simple" update to pip isn't an option for me, that's not how we do things.
I eventually figured out the solution: I'd built the package incorrectly.
Cryptography 2.1.4 depends on cffi > 1.7. Both of these packages have new deliverable bits compared to the versions we were shipping.
Failing to update the package manifest to correctly track the new files results in both cffi and cryptography being unable to import symbols that the current versions depend upon.
[A very big thankyou to Alex Gaynor in #cryptography-dev who set me on the right path to figuring this out].
$ python2.7
Python 2.7.14 (default, Jan 31 2018, 05:35:05) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.hazmat.bindings._openssl import ffi, lib
>>> from cryptography.x509 import certificate_transparency
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/vendor-packages/cryptography/x509/__init__.py", line 7, in <module>
from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency
If you build cryptography and look at what it delivers, you will find that there is in fact a file (shipped on Solaris as /usr/lib/python-$(PYVER)/vendor-packages/cryptography/x509/certificate_transparency.py) - and if that file isn't in the rest of the hierarchy then you end up with exactly this ImportError.
it works for me (problems with paramiko):
https://pypi.python.org/pypi/ctutlz/0.7.0
pip install --process-dependency-links ctutlz
I had a similar issue on RHEL 6.7 x86_64 running Python 2.7.8 with an old version of pip (1.4.1)
It was because I had been installing the "cp27m" builds rather than "cp27mu" builds.
With the old pip 1.4.1 build, it did not complain installing the cp27m builds.
Whereas when upgrading pip to 9.0.3, it spat out the true error ...
(bmcs2)bash-4.1$ pip install cffi-1.11.5-cp27-cp27m-manylinux1_x86_64.whl
cffi-1.11.5-cp27-cp27m-manylinux1_x86_64.whl is not a supported wheel on this platform.
(bmcs2)bash-4.1$ pip install cryptography-2.1.3-cp27-cp27m-manylinux1_x86_64.whl
cryptography-2.1.3-cp27-cp27m-manylinux1_x86_64.whl is not a supported wheel on this platform.
The "ImportError: cannot import name certificate_transparency" was resolved using the "cp27mu" builds. When using the "cp27mu" build, both the pip 1.4.1 and pip 9.0.3 versions worked fine.
cffi-1.11.5-cp27-cp27m-manylinux1_x86_64.whl versus cffi-1.11.5-cp27-cp27mu-manylinux1_x86_64.whl
cryptography-2.1.3-cp27-cp27m-manylinux1_x86_64.whl versus cryptography-2.1.3-cp27-cp27mu-manylinux1_i686.whl
More info here:
https://www.python.org/dev/peps/pep-0513/#ucs-2-vs-ucs-4-builds
I think this more like a paramiko issue not pip. Upgrading pip didn't solve this in my environment i had to downgrade my paramiko version to a version that does not have a libffi dependency, this worked for me:
pip2.7 install paramiko==1.17.0
this issue is related to: https://github.com/paramiko/paramiko/issues/1401
I got this error while trying to run Scrapy in AWS Lambda, deploying with a zip file.
I followed the instructions in https://www.perrygeo.com/running-python-with-compiled-code-on-aws-lambda.html, which basically instructs you to start an Amazon Linux EC2 instance, install the requirements and build the zip from it.
After setting up the whole thing, the first package I created still gave me the same error, but I realised that was because a hidden folder, .libs_cffi_backend, was missing from the zip file. That folder contains a .so file that if not present causes ImportError. After forcefully including it, it worked.
A have a problem where try to install module from pip like:
Install packages failed: Error occurred when installing package lxml.
The following command was executed:
packaging_tool.py install --build-dir C:\Users\User\AppData\Local\Temp\pycharm-packaging2629877941665473195.tmp lxml
The error output of the command:
C:\Python32\lib\site-packages\pip\_vendor\pkg_resources\__init__.py:87: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
warnings.warn(msg)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\packaging_tool.py", line 125, in main
retcode = do_install(pkgs)
File "C:\Program Files (x86)\JetBrains\PyCharm 3.1\helpers\packaging_tool.py", line 56, in do_install
import pip
File "C:\Python32\lib\site-packages\pip\__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:\Python32\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "C:\Python32\lib\site-packages\pip\download.py", line 36, in <module>
from pip.utils.ui import DownloadProgressBar, DownloadProgressSpinner
File "C:\Python32\lib\site-packages\pip\utils\ui.py", line 15, in <module>
from pip._vendor.progress.bar import Bar, IncrementalBar
File "C:\Python32\lib\site-packages\pip\_vendor\progress\bar.py", line 48
empty_fill = u'\u2219'
^
SyntaxError: invalid syntax
How fix this? I can not install any module or rollback pip.
Python 3.2
Pip 8.1.1
You need to upgrade your Python. Python 3.2 does not support Unicode string literals with the u"..." syntax (the idea was that these are not needed anymore because all string literals are Unicode in Python 3.x). This is why you are getting the error.
In Python 3.3, this feature was restored to make it easier to write code that runs on either Python 2.x or 3.x and clearly PIP is taking advantage of this.
Indeed, the documentation for PIP 8.1.1 mentions that it needs Python 3.3 or later.
I have a situation in win7 64bit, after I installing paramiko 1.12.1 by using easy_install paramiko,I'm using 64bit python2.7 , also installed 64bit pycrypto, there is a import error:
>>> import paramiko
enter code hereenter code hereTraceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import paramiko
File "build\bdist.win-amd64\egg\paramiko\__init__.py", line 65, in <module>
File "build\bdist.win-amd64\egg\paramiko\transport.py", line 33, in <module>
File "build\bdist.win-amd64\egg\paramiko\util.py", line 33, in <module>
File "build\bdist.win-amd64\egg\paramiko\common.py", line 98, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\__init__.py", line 28, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\__init__.py", line 34, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\nt.py", line 28, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\winrandom.py", line 7, in <module>
File "c:\users\yapan\appdata\local\temp\easy_install-6upp3i\pycrypto-2.6-py2.7-win-amd64.egg.tmp\Crypto\Random\OSRNG\winrandom.py", line 6, in __bootstrap__
ImportError: DLL load failed: %1 is not a valid Win32 application.
Any thoughs?
This is a problem I ran into as well. I have Windows Server 2012 64 bit and python 32 bit. What I ended up doing is letting pip solve everything.
I have pip 1.6.dev1.
pip install --upgrade paramiko
*if you get this error during upgrade:
AttributeError: 'str' object has no attribute 'rollback', do:
pip uninstall pycrypto and enter (y)
pip install pycrypto
pip install ecdsa
Basically, just try to run that first command, and follow the tracebacks to resolve whatever dependency is missing. This worked for me.
I saved my session in txt if you need it for reference.
-Daniel
If you are having trouble building and installing Python 2.7 components that depend on compiled C modules, I highly recommend you check out Microsoft's specially packaged compiler for Python 2.7, here:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
I had ALL kinds of trouble getting pycrypto to install on Windows 7 64-bit (I was trying to get Fabric to work, which depends on paramiko which depends on pycrypto). After installing the aforementioned compiler and then doing:
pip install wheel
pip uninstall pycrypto paramiko
pip install paramiko
Everything just started working! Hope that helps anyone landing on this answer from Google in the future.