We have python 2.7 installed on server
Tried installing pip by following steps
1) downloaded pip-19.1.1 tar file from internet on local machine(ubuntu)
2) transfered file to server and extracted the content
2) ran setup.py file present in the folder using comman python setup.py
but giving below error
Traceback (most recent call last):
File "/usr/bin/Python-2.7.12/Lib/site.py", line 548, in <module>
main()
File "/usr/bin/Python-2.7.12/Lib/site.py", line 530, in main
known_paths = addusersitepackages(known_paths)
File "/usr/bin/Python-2.7.12/Lib/site.py", line 266, in addusersitepackages
user_site = getusersitepackages()
File "/usr/bin/Python-2.7.12/Lib/site.py", line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/bin/Python-2.7.12/Lib/site.py", line 231, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/bin/Python-2.7.12/Lib/sysconfig.py", line 520, in get_config_var
return get_config_vars().get(name)
File "/usr/bin/Python-2.7.12/Lib/sysconfig.py", line 472, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/bin/Python-2.7.12/Lib/sysconfig.py", line 356, in _init_posix
from _sysconfigdata import build_time_vars
ImportError: No module named _sysconfigdata\
Also downloaded get-pip.py file from link https://bootstrap.pypa.io/get-pip.py. Executed python get-pip.py on server but giving the above same error.
Related
I'm trying to get django-location-field installed on django version 2.1.2 using python3.
I installed it and added location_field.apps.DefaultConfig to settings, then an error pops up for a missing package gdal.
Error
python3 manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7efbf9f56d90>
Traceback (most recent call last):
...
File "/home/samuel/Documents/code/DECOMAGNA/decomagna/inventory/models.py", line 3, in <module>
from django.contrib.gis.geos import Point
...
from django.contrib.gis import gdal
...
File "/home/samuel/.local/lib/python3.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "/home/samuel/.local/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 43, in <module>
% '", "'.join(lib_names)
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
Trying to install it throws an error for the package.
pip3 install GDAL
Collecting GDAL
Using cached https://files.pythonhosted.org/packages/e5/57/7f0536cd46bebb30e709b8cd3bcebf9c3d4acc4ad5e9d7bfc73cd39c09a9/GDAL-2.3.2.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/GDAL.egg-info
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "/tmp/pip-build-84b30dz9/GDAL/setup.py", line 153, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-84b30dz9/GDAL/setup.py", line 240, in get_gdal_config
return fetch_config(option, gdal_config=self.gdal_config)
File "/tmp/pip-build-84b30dz9/GDAL/setup.py", line 157, in fetch_config
raise gdal_config_error(e)
__main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config': '../../apps/gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/pip-build-84b30dz9/GDAL/setup.py", line 153, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-84b30dz9/GDAL/setup.py", line 435, in <module>
setup(**setup_kwargs)
File "/home/samuel/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 140, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
...
raise gdal_config_error(e)
__main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config': 'gdal-config'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-84b30dz9/GDAL/
I'm also using it on a virtualenv and I've also tried using a --user with no success.
I've added this as the code for
since you are using ubuntu machine, run this command in the terminal
sudo apt-get install binutils libproj-dev gdal-bin
Python: 2.7.12
Pip: 8.1.1
When I sudo pip install pandas, it shows as follows:
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'
download .whl file for pandas
try
pip install pandas.whl
or upgrade or pip and repeat the command
pip install pandas
I think there is some problem with pip command. So you can install Anaconda for python 2.7 (Download). It comes with pip by default.
Once download will be completed (it is script file).
Give the permission to the script file.
sudo chmod 777 Anaconda2-5.1.0-Linux-x86_64.sh
Run the script file on terminal../Anaconda2-5.1.0-Linux-x86_64.sh or bash Anaconda2-5.1.0-Linux-x86_64.sh
Follow the instruction from point 4th to this document here
When I try pip freeze (or pip freeze > requirements.txt), I've this error :
$ pip freeze
Error [Errno 20] Not a directory: '/usr/local/lib/python2.7/dist-packages/flaskr-0.0.0-py2.7.egg' while executing command git rev-parse
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/commands/freeze.py", line 86, in run
for line in freeze(**freeze_kwargs):
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/operations/freeze.py", line 50, in freeze
dependency_links
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/__init__.py", line 255, in from_dist
if dist_is_editable(dist) and vcs.get_backend_name(location):
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/vcs/__init__.py", line 76, in get_backend_name
if vc_type.controls_location(location):
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/vcs/git.py", line 292, in controls_location
on_returncode='ignore')
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/vcs/__init__.py", line 325, in run_command
spinner)
File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 667, in call_subprocess
cwd=cwd, env=env)
File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 20] Not a directory: '/usr/local/lib/python2.7/dist-packages/flaskr-0.0.0-py2.7.egg'
I've not error(s) when I install some package. I don't use virtualenv for the moment.
Have an idea about this error please ?
Thanks.
F.
It was just a problem with Flaskr (I don't know why it was here...)
So, I just do :
sudo pip uninstall Flaskr
And, it's done.
Whats I'll do ?
odoo#odoo-Aspire-ES1-572:~$ pip2 install pyboleto
Collecting pyboleto
Using cached pyboleto-0.3.1.tar.gz
Collecting distribute (from pyboleto)
Using cached distribute-0.7.3.zip
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/distribute.egg-info
writing requirements to pip-egg-info/distribute.egg-info/requires.txt
writing pip-egg-info/distribute.egg-info/PKG-INFO
writing top-level names to pip-egg-info/distribute.egg-info/top_level.txt
writing dependency_links to pip-egg-info/distribute.egg-info/dependency_links.txt
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-wdypyY/distribute/setup.py", line 58, in <module>
setuptools.setup(**setup_params)
File "/home/odoo/.pyenv/versions/2.7.12/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/home/odoo/.pyenv/versions/2.7.12/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/home/odoo/.pyenv/versions/2.7.12/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setuptools/command/egg_info.py", line 177, in run
writer = ep.load(installer=installer)
File "pkg_resources.py", line 2241, in load
if require: self.require(env, installer)
File "pkg_resources.py", line 2254, in require
working_set.resolve(self.dist.requires(self.extras),env,installer)))
File "pkg_resources.py", line 2471, in requires
dm = self._dep_map
File "pkg_resources.py", line 2682, in _dep_map
self.__dep_map = self._compute_dependencies()
File "pkg_resources.py", line 2699, in _compute_dependencies
from _markerlib import compile as compile_marker
ImportError: No module named _markerlib
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wdypyY/distribute/
odoo#odoo-Aspire-ES1-572:~$ pip2 install _markerlib
Invalid requirement: '_markerlib'
Traceback (most recent call last):
File "/home/odoo/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 82, in __init__
req = Requirement(req)
File "/home/odoo/.local/lib/python2.7/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
requirement_string[e.loc:e.loc + 8]))
InvalidRequirement: Invalid requirement, parse error at "'_markerl'"
Please try the following:
sudo apt-get update # Fetches the list of available updates
sudo apt-get upgrade # Strictly upgrades the current packages
sudo apt-get dist-upgrade # Installs updates (new ones)
sudo pip install pyboleto
All of a sudden When I try to add python3 to virtualenv like this
virtualenv -p python3 env
I get the following error
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 726, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 746, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv-13.1.2.dist-info/DESCRIPTION.rst'
This just started happening out of nowhere a few hours ago because I have been using it tonite. Can anyone tell me what's going on with this? thanks