After a recent El Capitan update, when I open the terminal I get the error below without attempting anything.
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/site-packages/virtualenvwrapper/hook_loader.py", line 8, in <module>
import inspect
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/inspect.py", line 39, in <module>
import tokenize
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tokenize.py", line 29, in <module>
from itertools import chain
ImportError: No module named itertools
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.
If I run python (2.7.9) in the command line it works, but it fails when I try to import zlib with no module zlib error.
I tried to reinstall pip through easy install, so I can reinstall virtualenv and virtualenvwrapper, but when I try sudo easy install I get "zipimport.ZipImportError: can't decompress data; zlib not available".
So I then tried to change the .bash_profile, but I really don't know how to change it, because I don't understand path and environmental variables. CURRENT bash_profile content is:
export PATH=/usr/local/share/python:$PATH
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
My last hope is that if I can point the path in the right direction everything will get solved.
Related
I need to install an older version of DVC, namely 0.9.4, in a Python virtual environment.
I used the command:
pip install dvc==0.9.4
Everything seemed to work fine. However, when I try to run a dvc pull command, I get the following error:
Traceback (most recent call last):
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\lbrandao\anaconda3\envs\my_env\Scripts\dvc.exe\__main__.py", line 4, in <module>
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\main.py", line 2, in <module>
from dvc.cli import parse_args
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cli.py", line 8, in <module>
from dvc.command.init import CmdInit
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\command\init.py", line 1, in <module>
from dvc.project import Project
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\project.py", line 15, in <module>
from dvc.cloud.data_cloud import DataCloud
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cloud\data_cloud.py", line 11, in <module>
from dvc.cloud.gcp import DataCloudGCP
File "c:\users\lbrandao\anaconda3\envs\my_env\lib\site-packages\dvc\cloud\gcp.py", line 4, in <module>
from google.cloud import storage as gc
ModuleNotFoundError: No module named 'google.cloud'
When I print the dvc version, I see:
0.9.4+6bb66e.mod
Can anyone please help? Thanks.
Assuming the remote storage is on Google Cloud based on that error, you may need to install the special dvc[gs] module instead, e.g.:
pip install dvc[gs]==0.9.4
See https://dvc.org/doc/install/linux#install-with-pip
BTW DVC 1.x should be backward compatible with DVC 0.9 in case you want to try a newer version.
Also, try to migrate your project to DVC 2.x (latest as of now), here are some guidelines: https://dvc.org/blog/dvc-2-0-release#breaking-changes
I was able to overcome the previous issue with:
pip install --upgrade google-cloud-storage
Whenever I try to use pip, using any command I get this:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsdra8p0\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsd8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_q3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\progress_bars.py", line 8, in <module>
from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
ModuleNotFoundError: No module named 'pip._vendor.progress'
PS C:\Users\SE> No module named 'pip._vendor.progress'No module named 'pip._vendor.progress'
I am on Windows 10, 64 bit, Python version 3.7.7.
I cannot use pip, how can I fix it?
If pip is broken after an attempted upgrade to a newer version, try the following:
Download get-pip.py and "Save As" the file using right-click.
Open a command prompt as an administrator
cd to the path where you saved the file, in my case
cd C:\Users\xyz\Downloads> then type python get-pip.py. It will install all required packages, such as wheel and pip.
To check if it installed correctly, type pip --version in the command line.
Hope my answer helps someone. Happy coding. 🙂
Try doing python -m pip install pytest. This should install it, and it will make it usable by your IDE.
Hope this helps!
You could follow the equivalent steps mentioned here and here (Both are closed issues on pip's github page) on your windows machine.
On windows you can do this:
python -m pip uninstall pip setuptools # Sometimes setuptools might be the problem
This will uninstall pip and setuptools.
After which you can reinstall them using
python -m ensurepip
This will install pip and setuptools.
I have tried this on my windows 10 machine running Python 3.7.4!
When I try to install any module for python using command prompt or PowerShell, then there is a message that shows up, the message is:
File "c:\users\opkp\app data\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\OPKP\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe\__main__.py", line 5, in <module>
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 7, in <module>
from .connectionpool import (
File "c:\users\opkp\appdata\local\programs\python\python38-32\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
ModuleNotFoundError: No module named 'pip._vendor.urllib3.exceptions'
I know it has the names of my drivers and all. Due to this, I am not able to download any module for python.
Things that I have tried and that failed me:
I Googled it
YouTube videos were not tackling my problem, what they were telling me is just how to install pip (which I already have) and how to add the path (which I have already done)
Commands that gave this error:
pip install flask
py -m ( I don't remember it fully but i wrote it correctly )
pip3 install flask
and i have also uninstalled and installed python
etc.
Here is my error message in the command prompt:
I also tried that py -m statement but that also gave the same result.
You can try to re-install pip or even completely re-install Python.
I have read many of the questions and answers regarding "IncompleteRead" most, if not all, of them end up with a recommendation to uninstall and reinstall pip, or upgrade pip, or uninstall and reinstall the package you are trying to install.
I am not able to even upgrade pip or uninstall it.
Here is the traceback:
c:\Python27>python.exe -m pip install -U pip
Traceback (most recent call last):
File "c:\Python27\lib\runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name)
File "c:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "c:\Python27\lib\site-packages\pip\__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "c:\Python27\lib\site-packages\pip\_internal\__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "c:\Python27\lib\site-packages\pip\_vendor\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "c:\Python27\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 11, in <module>
from .exceptions import (
File "c:\Python27\lib\site-packages\pip\_vendor\urllib3\exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
ImportError: cannot import name IncompleteRead
Any suggestions?
You can try and remove requests module first dist-packages
rm -rf python2.7/dist-packages/requests*
pip module need requests module to download packages from Python Package Index.
Hope this might help
I suggest you download the package yourself from here or find it yourself, and then try pip install urllib3-1.25.7-py2.py3-none-any.whl (replace the filename with the wheel you download). This way, you can reinstall urllib3 without importing it first.
I installed again my openerp project in another machine and added pydev to eclipse then when i going to run openerp-server file below error has come.seems something missing with installing procedure.
please help me to sort out this issue
pydev debugger: starting
Traceback (most recent call last):
File "/home/priyan/Softwares/eclipse/dropins/PyDev 2.7.3/plugins/org.python.pydev_2.7.3.2013031601/pysrc/pydevd.py", line 1397, in <module>
debugger.run(setup['file'], None, None)
File "/home/priyan/Softwares/eclipse/dropins/PyDev 2.7.3/plugins/org.python.pydev_2.7.3.2013031601/pysrc/pydevd.py", line 1090, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/home/priyan/Softwares/openerp-7.0/openerp-server.py", line 2, in <module>
import openerp
File "/home/priyan/Softwares/openerp-7.0/openerp/__init__.py", line 39, in <module>
import addons
File "/home/priyan/Softwares/openerp-7.0/openerp/addons/__init__.py", line 38, in <module>
from openerp.modules import get_module_resource, get_module_path
File "/home/priyan/Softwares/openerp-7.0/openerp/modules/__init__.py", line 27, in <module>
from . import db, graph, loading, migration, module, registry
File "/home/priyan/Softwares/openerp-7.0/openerp/modules/graph.py", line 32, in <module>
import openerp.osv as osv
File "/home/priyan/Softwares/openerp-7.0/openerp/osv/__init__.py", line 22, in <module>
import osv
File "/home/priyan/Softwares/openerp-7.0/openerp/osv/osv.py", line 28, in <module>
from psycopg2 import IntegrityError, OperationalError, errorcodes
ImportError: No module named psycopg2
when i use apt get for install it via terminal then error says as below
root#priyan-pc:~# sudo apt-get install python-psycopg2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-psycopg2
root#priyan-pc:~#
It seems psycopg2 is not installed in your system. First install psycopg2 and then run OpenERP server.
Command to install psycopg2:
sudo apt-get install python-psycopg2
or
sudo easy_install psycopg2
or
You can download latest package (tar.gz) from Download pysycopg2. After that extract it, open terminal and run setup.py file.
sudo python setup.py install