I am unable to install dash in production server. In local, I have imported by
pip install dash==0.29.0
But in prod it is not working. When i am using
sudo apt-get install python dash
its showing
> "dash is already the newest version (0.5.8-2.4)"
, however while using import dash am getting
> "ImportError: No module named dash"
have also tried
sudo pip install python dash==0.29.0
but it gives below error:
Requirement already satisfied: python in /usr/lib/python2.7/lib-dynload
Collecting dash==0.29.0
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 501, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/adapters.py", line 423, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 643, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 315, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
The command sudo apt-get install python dash installs the system package python (correct) and the system package dash (incorrect), which is a linux shell.
After installing Python with sudo apt-get install python, to install the python package dash, you need to do sudo pip install dash==0.29.0 or sudo python -m pip install dash==0.29.0.
From what I can tell - and I am extremely green - it appears that python / environments scan for modules by filename in the appropriate "site packages" directory. I had installed Dash via command prompt for my system python and then also via the anaconda command prompt.
When I would try to import dash in Spyder through anaconda, I got this same error. I was able to fix the issue by renaming the folder that contained the init file from dash_rendered to just dash.
It would appear that then when Spyder scanned it's packages, it could identify the correct directory.
I had no trouble installing dash to python generally with the command provided from Plotly in the command line.
pip install dash==1.7.0
I can see this was a year ago and that Dash has changed a bit since then - but hopefully this helps future users whose environments aren't recognizing the module as "dash" without renaming, as in Spyder.
I had the same problem, I solved it running pip install dash on conda terminal (if you are using Anaconda).
Create a virtual environment:
virtualenv venv # creates a virtualenv called "venv"
source venv/bin/activate # uses the virtualenv
and then pip install dash
If you are using Jupyter notebook or Jupyter Lab, try to install jupyter-dash by:
pip install jupyter-dash
in the code:
from jupyter_dash import JupyterDash
pd.options.plotting.backend = "plotly"
file>NewProjectsSetup>Preferencesfornewprojects>PythonInterpreter> click on + symbol to search for packages, search for dash, install the package and you should be fine.
Related
Had PIP working normally until few days ago.
Not sure how.
Trying to run it now and now show issues.
Adding full stack bellow of the error:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 487, in _prepare_file
req_to_install, finder)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 428, in _check_skip_installed
req_to_install, upgrade_allowed)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/local/lib/python2.7/site-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 390, in send
conn = self.get_connection(request.url, proxies)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 290, in get_connection
proxy_manager = self.proxy_manager_for(proxy)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 194, in proxy_manager_for
**proxy_kwargs)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py", line 367, in proxy_from_url
return ProxyManager(proxy_url=url, **kw)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py", line 312, in __init__
proxy = parse_url(proxy_url)
File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py", line 189, in parse_url
raise LocationParseError(url)
LocationParseError: Failed to parse: user:pass
Want to try to reinstall pip completely.
What is recommended way to do it?
Your pip and Python installations are fine. What's wrong is your proxy configuration.
On OS X, both environment variables and the OS X network configuration can supply proxy information. First find out what configuration you have with:
python2.7 -c 'import urllib, pprint; pprint.pprint(urllib.getproxies())'
then look for any incorrect configuration in both your network settings (in the system configuration, check active networks for the proxies tab), and in your environment variables for *_proxy entries (http_proxy, https_proxy, etc.).
You can manually override proxies by setting one on the command line with the --proxy switch:
pip --proxy= install ...
Note the empty --proxy=; or you can set a specific proxy.
If you really did need to re-install your Python setup, you appear to have installed yours with Homebrew, so you can re-install it with brew install -f python#2.
Download Anaconda (or Miniconda), run it, and restart your terminal then start using environments.
to create an environment type
conda create -n my_project_name python=3.6
conda activate my_project_name
Now do all the pip installs and conda installs you want.
Your path is fixed. Pip is fixed. Go crazy.
Edit:
Now that you've posted your full traceback it looks like you need to feed the proxy a username and password. Here is one way to do it.
pip install --proxy=https://user#mydomain:port somepackage
I'm trying to make a setup script for a python package. For an easy setup, I would like that all the dependencies be installed using setuptools. However, I found some difficulties when installing these packages this way: numpy, matplotlib, scipy, netcdf4, pandas and pymatgen. The numpy problem was already asked in this SO post, matplotlib here, pandas here and scipy here. So it seems it is a recurring problem though I have found a workaround for each of these packages which is to use pip in the setup script:
from setuptools import pip
import pip
for package in ("numpy", "matplotlib", "scipy", "netcdf4", "pandas",
"pymatgen"):
pip.main(["install", package])
setup(name="package_name",
...)
The problem is that when another package requires this package, the fact that pip is called to install the dependencies, setuptools raises a weird SandBoxViolation Error which prevent the use of the pip.main function.
Here's an example traceback:
Traceback (most recent call last):
File ".../lib/python3.6/site-packages/pip/basecommand.py", line 215,
in main
status = self.run(options, args)
File ".../lib/python3.6/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File ".../lib/python3.6/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File ".../lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File ".../lib/python3.6/site-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File ".../lib/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File ".../lib/python3.6/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File ".../lib/python3.6/site-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File ".../lib/python3.6/site-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File ".../lib/python3.6/site-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File ".../lib/python3.6/site-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File ".../lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File ".../lib/python3.6/site-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File ".../lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File ".../lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File ".../lib/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 37, in send
cached_response = self.controller.cached_request(request)
File ".../lib/python3.6/site-packages/pip/_vendor/cachecontrol/controller.py", line 202, in cached_request
self.cache.delete(cache_url)
File ".../lib/python3.6/site-packages/pip/download.py", line 302, in delete
return super(SafeFileCache, self).delete(*args, **kwargs)
File ".../lib/python3.6/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py", line 107, in delete
os.remove(name)
File ".../lib/python3.6/site-packages/setuptools/sandbox.py", line 314, in wrap
path = self._remap_input(name, path, *args, **kw)
File ".../lib/python3.6/site-packages/setuptools/sandbox.py", line 456, in _remap_input
self._violation(operation, os.path.realpath(path), *args, **kw)
File ".../lib/python3.6/site-packages/setuptools/sandbox.py", line 411, in _violation
raise SandboxViolation(operation, args, kw)
setuptools.sandbox.SandboxViolation: SandboxViolation:
remove('/.../Library/Caches/pip/http/8/f/4/a/1/8f4a19894a92f9
63886c9b755abcf90542da3c3c8283d3bebe3650b2',) {}
The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.
This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand. Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.
A workaround for this is to use the pip.main method for this package also...
So I conclude that the use of the pip.main function should be avoided but I don't know an easy way to install the problematic dependencies. So my question is: how should the problematic dependencies like numpy, scipy, pymatgen, etc. be handled in order to install them automatically (without pip, just with setuptools for instance)? If it is not possible to avoid the usage of pip, how should the package calling pip in it's setup should be installed (in order to avoid the SandboxViolation errors)?
I'm using Python 3.5 and I am trying to install some packages. I usually use conda and everything's fine when I do but some packages is not in the anaconda repository and so I then use pip (either pip or pip3).
For some reason I get this error when I try to install any package not installed:
$ pip3 install pyqt3d
Exception:
Traceback (most recent call last):
File "C:\Users\MonsterIguan\Anaconda3\lib\site- packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\req\req_set.py", line 487, in _prepare_file
req_to_install, finder)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\req\req_set.py", line 428, in _check_skip_installed
req_to_install, upgrade_allowed)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\index.py", line 568, in _get_pages
page = self._get_page(location)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\index.py", line 811, in get_page
inst = cls(resp.content, resp.url, resp.headers)
File "C:\Users\MonsterIguan\Anaconda3\lib\site-packages\pip\index.py", line 728, in __init__
self.parsed = html5lib.parse(
AttributeError: module 'pip._vendor.html5lib' has no attribute 'parse'
I've seen some post with the same question but with inconclusive solutions. I am unfamiliar with pip/pip3 and rather scared of messing it up if I try to uninstall and install again. I still would rather use command line to install packages than manually installing with a .zip folder.
(I tried both on cmd and git bash)
First update conda:
conda update conda
then update pip with conda:
conda update pip
As a rule of thumb. Always use conda first before trying pip. That usually helps.
I am trying to install some python packages but I am getting this kind of error every time.
The directory '/home/username/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/username/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file
finder, self.upgrade, require_hashes)
File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page
"Cache-Control": "max-age=600",
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request
resp = self.send(prep, **send_kwargs)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send
r = adapter.send(request, **kwargs)
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send
resp = super(CacheControlAdapter, self).send(request, **kw)
File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send
timeout=timeout
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment
total -= 1
TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'
I looked it up on this site and Stack Overflow and all the solutions suggest installing
wheel
or
setuptools
But I am getting
Requirement already satisfied
The same problem occurs for trying to upgrade python packages.
Some of the commands that give me this error are:
sudo pip install -U textblob
My pip version is pip 8.1.1
What should I do?
Try, as suggested by the error message, running:
sudo -H pip install -U textblob
It is also well worth making sure that your version of pip is up to date with:
sudo python -m pip install -U pip
or
sudo -H python -m pip install -U pip
This happens to me frequently. Try this:
pip install textblob --user
This will work fine with other packages as well.
Thanks !
I am trying to deploy python flask application using apache2 and mod-wsgi.
I am following this link.
While installing mog-wsgi using the command sudo apt-get install libapache2-mod-wsgi ,I see these lines at the end
apache2_invoke: Enable module wsgi
Action 'configtest' failed.
The Apache error log may have more information.
apache2_reload: Your configuration is broken. Not restarting Apache 2
Is this a smooth installation?
Also, in step 1 of the link when I tried to create a virtual environment using the command
sudo virtualenv venv
This gives me error sudo: virtualenv: command not found
So, I tried to install virtualenv using sudo pip install virtualenv, I am getting this huge error in red(exception).
Downloading/unpacking virtualenv
Downloading virtualenv-15.0.1-py2.py3-none-any.whl (1.8MB): 733kB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
do_download,
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
self.session,
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 572, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 433, in _download_url
for chunk in resp_read(4096):
File "/usr/lib/python2.7/dist-packages/pip/download.py", line 421, in resp_read
chunk_size, decode_content=False):
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 225, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 174, in read
data = self._fp.read(amt)
File "/usr/lib/python2.7/httplib.py", line 573, in read
s = self.fp.read(amt)
File "/usr/lib/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
File "/usr/lib/python2.7/ssl.py", line 341, in recv
return self.read(buflen)
File "/usr/lib/python2.7/ssl.py", line 260, in read
return self._sslobj.read(len)
SSLError: The read operation timed out
Storing debug log for failure in /home/myname/.pip/pip.log
What could be the problem?
Please use apt-get install virtualenv or apt-get install python-virtualenv (depending on your OS version) instead of polluting the system with packages installed by sudo pip install.