When i try to import numpy to my python file it says:
Traceback (most recent call last):
File "c:\src\Python\Raycast_Test_1\test.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
(i just found some things in the pip help thingy so i did them and this is what i got)
and when i do pip search numpy this shows up:
ERROR: Exception:
Traceback (most recent call last):
File "c:\users\marti\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\base_command.py", line 224, in _main
status = self.run(options, args)
File "c:\users\marti\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\search.py", line 62, in run
pypi_hits = self.search(query, options)
File "c:\users\marti\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\commands\search.py", line 82, in search
hits = pypi.search({'name': query, 'summary': query}, 'or')
File "c:\users\marti\appdata\local\programs\python\python38\lib\xmlrpc\client.py", line 1109, in __call__
return self.__send(self.__name, args)
File "c:\users\marti\appdata\local\programs\python\python38\lib\xmlrpc\client.py", line 1450, in __request
response = self.__transport.request(
File "c:\users\marti\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\network\xmlrpc.py", line 46, in request
return self.parse_response(response.raw)
File "c:\users\marti\appdata\local\programs\python\python38\lib\xmlrpc\client.py", line 1341, in parse_response
return u.close()
File "c:\users\marti\appdata\local\programs\python\python38\lib\xmlrpc\client.py", line 655, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault -32500: "RuntimeError: PyPI's XMLRPC API has been temporarily disabled due to unmanageable load and will be deprecated in the near future. See https://status.python.org/ for more information.">
and when i do pip check numpy this shows up:
No broken requirements found.
i have tried uninstaling the installing numpy but that didnt fix it.
How do i fix this?
(note i am using the vscode terminal for this)
pip install numpy --upgrade
or
pip install numpy --upgrade --ignore-installed
Just to make sure you are running correct pip, try running "pip -V" or "pip --version", it gives you which version of python it refers to. Its also possible that you might have pip for say python 2.7, pip3 for python 3.6, and pip3.7 for python 3.7, if you have multiple versions of python installed. For simplicity you can set the most frequently used pip version as pip by setting an alias in ~/.bashrc. This is done by adding the following line in bashrc:
alias pip=pip3.6.
After this you can try and install the packages and import it swiftly.
Related
Hy Everyone,
I try to install a script on my server using a terminal but due the installation I get an error. I will past here, the last lines of terminal.
Traceback (most recent call last):
File "/usr/bin/paster", line 4, in
command.run()
File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 93, in run
commands = get_commands()
File "/usr/lib/python2.7/dist-packages/paste/script/command.py", line 135, in get_commands
plugins = pluginlib.resolve_plugins(plugins)
File "/usr/lib/python2.7/dist-packages/paste/script/pluginlib.py", line 82, in resolve_plugins
pkg_resources.require(plugin)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: httpagentparser==1.7.8: Not Found for: r2 (did you run python setup.py develop?)
oneprovider#dedi-fr-20388:~$
Can someone help me to fix it ? Should install python develop ? If yes, how ? :D
As the error message is quite clear: httpagentparser is not installed https://pypi.python.org/pypi/httpagentparser
You should install it first, maybe it's available in the ubuntu software center. Else install via pip:
pip install httpagentparser
And if you don't know pip and/or have pip not installed. See https://pip.pypa.io/en/stable/installing/
Using OSX El Capitan. Just installed a bunch of pip module and was following a few online tutorials, must have broken something as now I get the following error whenever I try to use pip (although python seems to run fine).
$ pip install pandas
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2837, in <module>
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 451, in _build_master
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 464, in _build_from_requirements
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 639, in resolve
pkg_resources.DistributionNotFound: pip==1.5.6
Any helping fixing would be much appreciated.
Thanks.
Reinstall using easy_install. Close the terminal and reopen. Pip should now work.
Try updating pip first by typing pip install -U pip and the try pip install pandas. I myself use Anaconda/Miniconda. Most of the packages are well handled and the dependencies are taken care of as well by the conda package manager.
Django informs me "ImportError: No module named pytz", but when I go to use pip to install it, I get this result:
Requirement already satisfied (use --upgrade to upgrade): pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Is it possible that it is looking in the wrong location, or that I need to try to install it somewhere else?
Here is the full stacktrace:
Internal Server Error: /basicloginwebservice/
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py", line 103, in get_response
resolver_match = resolver.resolve(request.path_info)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 321, in resolve
sub_match = pattern.resolve(new_path)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 223, in resolve
return ResolverMatch(self.callback, args, kwargs, self.name)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 230, in callback
self._callback = get_callable(self._callback_str)
File "/Library/Python/2.7/site-packages/django/utils/functional.py", line 29, in wrapper
result = func(*args)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 97, in get_callable
mod = import_module(mod_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/<redacted>/django/<redacted>/<redacted>/views.py", line 3, in <module>
import pytz
ImportError: No module named pytz
Thanks
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras is a location associated with the Apple-supplied Python 2.7 (/usr/bin/python2.7). It's not possible to tell from the traceback but chances are that Django is being run under a different instance of Python 2.7, perhaps linked to from /usr/local/bin. These sorts of problems can arise when there are multiple instances of Python and you are using pip directly from the command line. Make sure you have a version of pip installed for each Python you are using. And, to ensure that you are using the right instance of pip, you can invoke it this way:
python -m pip install pytz
substituting for python the same path that is used to run Django.
Another approach is to always use an activated virtualenv which should ensure that the right python and pip instances are found first on the process PATH.
This is a head stumper so I am posting this question AFTER having examined and read all of the prior posts on this issue.
Running OSX 10.9 Python 2.7 no virtualenv
pip install awssh
Downloading/unpacking awssh
Downloading awssh-0.1.tar.gz
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py",
line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py",
line 274, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 1215, in prepare_files
req_to_install.run_egg_info()
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 288, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 265, in setup_py
import setuptools
File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extension import Extension
File "/Library/Python/2.7/site-packages/setuptools/extension.py", line 8, in <module>
File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 21, in <module>
packaging = pkg_resources.packaging
AttributeError: 'module' object has no attribute 'packaging'
This error is caused by the presence of an outdated version of pkg_resources. In order to get rid of the error, do the following:
Start a python session, import pkg_resources, and view the file from which it is loaded:
In [1]: import pkg_resources
In [2]: pkg_resources.__file__
Out[2]: '/usr/lib/python2.7/dist-packages/pkg_resources.pyc'
Remove this file (and the associated *.py file):
$ sudo rm /usr/lib/python2.7/dist-packages/pkg_resources.py*
That's it! Re-run the installation; it should complete without any errors:
$ sudo pip install awssh
Warning
If you're on a Debian based Linux system, this file might have been installed via the python-pkg-resources package. Therefore updating or reinstalling this package will reinstate the stale module! Also be aware that you're messing with a file which is supposed to be controlled by apt.
On a Windows 7 machine I am using the following command to install a package from a local directory:
pip install addons/pnc_tests --upgrade --extra-index-url=http://some_server/simple
which results in the following error:
C:\Users\alex\PNC\tas\ENV\Scripts\pip-script.py run on 07/16/14 07:50:47
Exception:
Traceback (most recent call last):
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\commands\install.py", line 258, in run
InstallRequirement.from_line(name, None))
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\req.py", line 173, in from_line
return cls(req, comes_from, url=url, prereleases=prereleases)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\req.py", line 71, in __init__
req = pkg_resources.Requirement.parse(req)
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2667, in parse
reqs = list(parse_requirements(s))
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2605, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
File "C:\Users\alex\PNC\tas\ENV\lib\site-packages\pip\_vendor\pkg_resources.py", line 2573, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'addons/pnc_tests', 'at', '/pnc_tests')
How to solve this problem?
I guess you are missing the parameter -r;
It must be like this if you have a requirement file to install from;
pip install -r addons/pnc_tests --upgrade --extra-index-url=http://some_server/simple
As it is defined on;
Pip Documentation
One need to replace the slash (/) by a backslash (\):
pip install addons\pnc_tests --upgrade --extra-index-url=http://some_server/simple
On my system I had just specified the wrong directory. Double check your folder names. x_x