After having downloaded get-pip.py attempting to install, and opening cmd window in windows 10 I am getting the following error message when I type pip and hit enter:
Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Users\adamh>pip
Traceback (most recent call last):
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\Scripts\pip.exe\__main__.py", line 5, in <module>
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 70, in <module>
from pip._vendor import appdirs
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\_vendor\appdirs.py", line 510, in <module>
import win32com.shell
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\win32com\__init__.py", line 6, in <module>
import pythoncom
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Users\adamh\AppData\Local\Programs\Python\Python35\lib\site-packages\win32\lib\pywintypes.py", line 117, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
AssertionError
C:\Users\adamh>
I tried all of the upgrades and such but none of them have been successful. Thank you very much for any help provided. Sincerely, will_learn
First Check if your python is running is properly from command prompt.
Open command prompt and run python it should show your python version else install it properly and add its path in environment variables
Mostly Pip should be already included in Python 2.7.9+ or 3.4+, but if for whatever reason it is not there, you can use the following one-liner.
Download https://bootstrap.pypa.io/get-pip.py and run it with Administrator permission python get-pip.py (If you are on Linux, use sudo python get-pip.py)
You must to add pip's path into Environment Variables. Pip is contained in python's script directory.
Example my case: C:\Python35\Scripts\pip.exe
To add path to environment variables.
Hold Win and press Pause.
Click Advanced System Settings.
Click Environment Variables.
Add C:\Python35\Scripts (Sorry I don't know name of python 3.5's directory) to the Path on System variables.
Restart Command Prompt.
Edit
In another way, you can use pip-Win instead of pip. Read more here: https://sites.google.com/site/pydatalog/python/pip-for-windows
Related
After I tried to install and register a new virtual environment so I can use it in Jupyter notebook, I ended up with the following problem: any notebook I open or create it displays the error message: "Could not find a kernel matching Python 3. Please select a kernel:"
but there are no kernels registered anymore ...
I couldn't find a good answer although I noticed that many others faced the same problem in the past. Anyone could help?
I am using Ubuntu and pip.
It seems to be a configuration problem with Jupyter.
$ jupyter --paths --debug
JUPYTER_PREFER_ENV_PATH is not set, making the user-level path preferred over the environment-level path for data and config
JUPYTER_NO_CONFIG is not set, so we use the full path list for config
JUPYTER_CONFIG_PATH is not set, so we do not prepend anything to the config paths
JUPYTER_CONFIG_DIR is not set, so we use the default user-level config directory
JUPYTER_PATH is not set, so we do not prepend anything to the data paths
JUPYTER_DATA_DIR is not set, so we use the default user-level data directory
JUPYTER_RUNTIME_DIR is not set, so we use the default runtime directory
config:
/home/florian/.jupyter
/home/florian/..../OCR/ocr_env/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/home/florian/.local/share/jupyter
jupyter kernelspec list
Available kernels:
ocr_env /home/florian/.local/share/jupyter/kernels/ocr_env
python3 /home/florian/.local/share/jupyter/kernels/python3
spark_env /home/florian/.local/share/jupyter/kernels/spark_env
tensorflow /home/florian/.local/share/jupyter/kernels/tensorflow
Another error trying to upgrade pip:
python -m pip install --upgrade pip
Traceback (most recent call last):
File "/home/florian/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/florian/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
from pip._internal.utils.misc import ensure_dir
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 33, in <module>
from pip._internal.locations import (
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>
from . import _distutils, _sysconfig
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/exceptions.py)
Seems I found a solution like this below:
pip3 install --force-reinstall jupyter_client
julia> import Pkg; Pkg.add("IJulia")
julia> using IJulia
julia> IJulia.notebook
💚 ❤️ 💜
Reference:
julia> is running julia.app on macOS
https://github.com/JuliaLang/IJulia.jl/issues/968#issuecomment-739800974
I install spacy on a Jupyter notebook Python 3, with Windows 10, and then try to install the English language model.
import spacy
!python -m spacy download en
The latter command givest me the following error:
Traceback (most recent call last):
File "C:\Users\naimb\Anaconda3\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Users\naimb\Anaconda3\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Users\naimb\Anaconda3\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\__init__.py", line 12, in <module>
from .cli.info import info as cli_info
File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\cli\__init__.py", line 6, in <module>
from .train import train # noqa: F401
File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\cli\train.py", line 17, in <module>
from ..gold import GoldCorpus
File "morphology.pxd", line 13, in init spacy.gold
File "vocab.pxd", line 27, in init spacy.morphology
File "vocab.pyx", line 20, in init spacy.vocab
File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\lemmatizer.py", line 8, in <module>
from .lookups import Lookups
File "C:\Users\naimb\Anaconda3\lib\site-packages\spacy\lookups.py", line 6, in <module>
from preshed.bloom import BloomFilter
ModuleNotFoundError: No module named 'preshed.bloom'
What's the preshed.bloom module? Following the answer in this question, I loaded the preshed wheel from this page (preshed‑3.0.2‑cp38‑cp38‑win_amd64.whl), but the problem remains.
Does anyone know how to fix this problem?
This is probably a version mismatch in one of spacy's dependencies. You shouldn't need to download wheels from a third-party site, installing with pip (or conda) should just work.
You can try pip install -U spacy in your current environment to update all the dependencies or if that doesn't help, try installing spacy from scratch in a new virtual environment.
(The answer you linked is a bit out-of-date, but as mentioned in the other answers, spacy only works with 64-bit python, so double-check that, too.)
I found 0 topics about this issue for Windows, only for Ubuntu, MAc etc.
When I try to install any package via Pycharm, e.g. urllib, matplotlib, heidi, I get the exact same error message as below.
Project interpreter is Anaconda Python 3.7.
Any idea how this can solved?
Error: Traceback (most recent call last):
File "E:\Download\PROGIK\Charm Community Edition 2018.3.5\helpers\packaging_tool.py", line 73, in run_pip
runpy.run_module(module_name, run_name='__main__', alter_sys=True)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 201, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\vcs\subversion.py", line 9, in <module>
from pip.index import Link
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\wheel.py", line 35, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\_vendor\distlib\scripts.py", line 14, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\_vendor\distlib\compat.py", line 66, in <module>
from urllib.request import (urlopen, urlretrieve, Request, url2pathname,
ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (E:\Download\PROGIK\Anaconda\lib\urllib\request.py)
Edit: with pip I have only problem with matplotlib, which is another topic:
Cannot install matplotlib. Fatal error LNK1181, Visual Studio fail
Simply went into packages folder and deleted matplotlib package manually because could not make it display graphs in Jupyter (didnt try in Pycharm). Trying to reinstall it now, hopefully it will fix the issue.
To install packages whithin anaconda environment under Windows10, you should use "Anaconda prompt" (find it in win menu)
It starts (Base) venv by default and installs packages in it. Therefore using Python interpreter distributed with Anaconda you will be able to import them with no side actions.
Besides matplotlib is installed there by default
I installed Python 3.4.0, but I can't use pip. So then I installed pip from python.org. Then I set PATH.
when I use pip, it reports these:
C:\Users\think\Downloads\pip-7.1.2>pip
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 171, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
...
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\conn
ectionpool.py", line 33, in <module>
from .connection import (
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\conn
ection.py", line 41, in <module>
from .util import (
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\util
\__init__.py", line 5, in <module>
from .ssl_ import (
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\util
\ssl_.py", line 4, in <module>
from ..exceptions import SSLError, InsecurePlatformWarning
ImportError: cannot import name 'InsecurePlatformWarning'
Python3.4.0 on Win32
Please assure that you are running pip module that was intalled in the include path of your python version.
You can do this via python -m pip install <somemodule>. If this fails you probably do not have the right module.
Also, you may want to install the modules for current user only, by using python -m pip install --user <somemodule>
I have installed Django 1.6.5 with PIP and Python 2.7.8 from the website.
I ran django-admin.py startproject test123, switched to test123 directory, and ran the command python manage.py runserver, then i get this:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/management/__init__.py", line 261, in fetch_command
commands = get_commands()
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/management/__init__.py", line 107, in get_commands
apps = settings.INSTALLED_APPS
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/conf/__init__.py", line 50, in _setup
self._configure_logging()
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/conf/__init__.py", line 72, in _configure_logging
from django.utils.log import DEFAULT_LOGGING
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/utils/log.py", line 7, in <module>
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/views/debug.py", line 10, in <module>
from django.http import (HttpResponse, HttpResponseServerError,
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/http/__init__.py", line 2, in <module>
from django.http.request import (HttpRequest, QueryDict, UnreadablePostError,
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/http/request.py", line 11, in <module>
from django.core import signing
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/core/signing.py", line 45, in <module>
from django.utils.crypto import constant_time_compare, salted_hmac
File "/Library/Python/2.7/site-packages/Django-1.6.5-py2.7.egg/django/utils/crypto.py", line 6, in <module>
import hmac
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hmac.py", line 8, in <module>
from operator import _compare_digest as compare_digest
ImportError: cannot import name _compare_digest
Found out that operator is a standard python library. Why cant it not import it?
P.S. I did try it in the command line, I can import the operator module, but I get an error on this statement: from operator import _compare_digest as compare_digest
Followed this SO answer:
Uninstall python.org version of python2.7 in favor of default OS X python2.7
Then changed my .bash_profile Python path to /usr/lib/python for the default OSX python path.
Uninstalled Django and MySQL-Python:
sudo pip uninstall django
sudo pip uninstall MySQL-Python
And then again reinstalled everything, but with MySQL-Python being the first and second Django.
After these steps, everything is working.
I get this error with anaconda as my default python and django1.7 while trying to use startproject.
I deleted the venv and recreated it with
virtualenv -p /usr/bin/python2.7 venv
startproject was working again.
You most likely have another file named operator.py on your PYTHONPATH (probably in the current working directory), which shadows the standard library operator module..
Remove or rename the file.
For those not wanting to switch to Apple's python, simply deleting the virtualenv and rebuilding it worked fine for me.
Tip: Don't forget to pip freeze > requirements.txt first if you aren't already tracking your package requirements. That way you can pip install -r requirements.txt to get up and running again quickly.