I'm trying to use a Python package called csvkit on an AWS EC2 machine. I was able to install it after some hiccups, which might be related - running pip install csvkit threw an error at
with open(path, 'rb') as stream:
IOERROR: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/requires.txt'
But I was able to install it with some other command.
Now onto the original problem - when I try to run a simple function within the csvkit package like cavstat, this is the full error output:
[username ~]$ csvstat
Traceback (most recent call last):
File "/usr/local/bin/csvstat", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3020, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 614, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 920, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 815, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2552, in requires
dm = self._dep_map
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2537, in _dep_map
for extra, reqs in split_sections(self._get_metadata(name)):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2978, in split_sections
for line in yield_lines(s):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2252, in yield_lines
for ss in strs:
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2566, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1589, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1581, in get_metadata
return self._get(self._fn(self.egg_info, name))
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1692, in _get
with open(path, 'rb') as stream:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/python_dateutil-2.2-py2.7.egg/EGG-INFO/requires.txt'
I'm not sure what to even search to see what's the issue. Is this related to date-utils?
I'm fairly new to the Linux world, so editing configuration files and whatnot is a bit difficult for me.
If you're doing a system-wide install via 'pip install csvkit', you'll need sudo privileges for the current user, which is why the install process has borked on modifying the /usr/local/lib/python2.7 structure.
If you're on an AWS instance you've created, sudo privileges should be pretty straightforward to set up for your current user.
If you're looking for a more contained alternative, you could install virtualenv and set up an isolated virtualenv (https://virtualenv.pypa.io/en/latest/installation.html) but virtualenv might be overkill for a throwaway server.
Does that help at all?
Related
I am trying to install Pip and anaconda.
In my mac I have both python 2 as well as python 3.
When I try to easy_install pip I get the error [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-14341.write-test'
So I tried to do a pip install
I GOT
Traceback (most recent call last):
File "/usr/local/bin/pip", line 6, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3241, in <module>
#_call_aside
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3225, in _call_aside
f(*args, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 585, in _build_master
return cls._build_from_requirements(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 598, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==19.3.1' distribution was not found and is required by the application
Also I cannot install Anaconda, maybe because of this problem
PS. I have used homebrew to install python.
Have anyone solved it?
One of the problem is that from now on we to use pip3 instead of just pip. Another problem is that the open ~/.zshrc file need to be updated with the same open ~/.bash_profile instruction from anaconda.
IN CONCLUSION
I think that for installing pip packages you need to use the pip3 command or you could write an alias file where you substitute pip with pip3.
Then for actually using conda I followed this article so that it overrun the zhs of the mac config.
Getting Anaconda to work
I'm trying to create a virtualenv, but I'm getting a Permission denied error. I'm using the following code
python2.7 -m virtualenv -p `which python2.7` test
Which gives this error message:
--edit--
I get a permission denied error
Traceback (most recent call last):
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/wheel.py", line 287, in clobber
ensure_dir(dest) # common for the 'include' path
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/home/marco/development/openplus/lambda/resizeTestSam/test/lib/python2.7/os.py", line 152, in makedirs
makedirs(head, mode)
File "/home/marco/development/openplus/lambda/resizeTestSam/test/lib/python2.7/os.py", line 159, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/lib/python2.7'
and a final error the operation failed
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv.py", line 2328, in <module>
main()
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv.py", line 713, in main
symlink=options.symlink)
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv.py", line 945, in create_environment
download=download,
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/home/marco/.local/lib/python2.7/site-packages/virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/marco/developm...m/test/bin/python2.7 - setuptools pip wheel failed with error code 2
To debug the error in os.py, I've added a print statement, it looks like the script tries to make the directories /lib/python2.7 and /lib/python2.7/site-packages. I don't understand why virtualenv tries to create these directories there and not in my current directory.
I've installed virtualenv without sudo, so I don't expect it to create directories in a path that is owned by root.
In the end only the python executable is copied to the 'test' directory, but not setuptools, pip and wheels.
Is there a way to avoid virtualenv from accessing root owned directories?
--update--
using python3 with venv works fine, the problem is with virtualenv specifically.
Executing virtualenv from my home directory give no error.
Looks like you're trying to create the virtualenv test within /lib/python2.7/site-packages, which, by all rights, you shouldn't have write access to.
Try running cd ~ first, to create the venv in your home directory.
I had the same mysterious error; it turns out I had forgotten a setting in my $HOME/.pip/pip.conf that changed the prefix.
I cannot install the package Neupy. I work with Python 3.5 and Windows 10..
I tried to clone it from the source code as follows:
git clone https://github.com/itdxer/neupy.git
cd neupy
python setup.py install
Here the error I got:
non-existing path in 'scipy\\integrate': 'quadpack.h'
error: no lapack/blas resources found
Also, I followed the solution given in this issue: https://stackoverflow.com/a/33369271/7492898
pip install neupy-1.0-py2.py3-none-any.whl
I got another problem here:
Exception:
Traceback (most recent call last):
File "c:\users\python\lib\site-packages\pip\basecommand.py", line 209, in main
status = self.run(options, args)
File "c:\users\python\lib\site-packages\pip\commands\install.py", line 310, in run
wb.build(autobuilding=True)
File "c:\users\python\lib\site-packages\pip\wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "c:\users\python\lib\site-packages\pip\req\req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\users\python\lib\site-packages\pip\req\req_set.py", line 577, in _prepare_file
session=self.session, hashes=hashes)
File "c:\users\python\lib\site-packages\pip\download.py", line 798, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "c:\users\python\lib\site-packages\pip\download.py", line 705, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "c:\users\python\lib\site-packages\pip\utils\__init__.py", line 599, in unpack_file
flatten=not filename.endswith('.whl')
File "c:\users\python\lib\site-packages\pip\utils\__init__.py", line 482, in unzip_file
zipfp = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\neupy\\neupy-1.0-py2.py3-none-any.whl'
EDIT : The solution was to use the whl from the official source which checks for the dependencies of lapack/blas:
Download the version of scipy suited for your OS and version lfd.uci.edu/~gohlke/pythonlibs/#scipy
Then enter the command:
pip install [Local File Location]\[Your specific file such as scipy-0.16.0-cp27-none-win_amd64.whl]
Finally pip works well for neupy:
pip install neupy
Forget everything you done before, all you need to do is type this in the Windows cmd to install neupy from Pypi.
pip install neupy
If you need more information see here: https://pypi.python.org/pypi/neupy
I'm trying to install virtualenvwrapper on a fresh Ubuntu 14.04 installation. I followed the steps here and added these lines to my .bashrc:
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
I get the following error message when I try and source ~/.bashrc:
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 217, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 131, in main
run_hooks(hook, options, args)
File "/usr/local/lib/python2.7/dist-packages/virtualenvwrapper/hook_loader.py", line 157, in run_hooks
hook_mgr = ExtensionManager(namespace)
File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 92, in __init__
verify_requirements)
File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 155, in _load_plugins
for ep in self._find_entry_points(self.namespace):
File "/usr/local/lib/python2.7/dist-packages/stevedore/extension.py", line 148, in _find_entry_points
eps = list(pkg_resources.iter_entry_points(namespace))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 515, in iter_entry_points
entries = dist.get_entry_map(group)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2371, in get_entry_map
self._get_metadata('entry_points.txt'), self
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2155, in parse_map
for group, lines in data:
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2715, in split_sections
for line in yield_lines(s):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1989, in yield_lines
for ss in strs:
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2305, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1369, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1361, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1470, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/numpydoc-0.4-py2.7.egg/EGG-INFO/entry_points.txt'
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
This happens when source /usr/local/bin/virtualenvwrapper.sh is executed.
Any ideas? Thanks.
EDIT: Although I am getting this error message, it seems my virtualenv is kind of working. I am able to create new env and even workon them. But every command I ttype, I get the IOError above.
Fixed. I just uninstalled the offending numpy doc package:
sudo pip uninstall numpydoc
i'm running Python 2.7 with my debian testing and i've a probleme using virtualenv.
Im trying to create a virtualenv on a partition which is mount like
/dev/sda5 /media/misc vfat users,defaults,uid=1000,gid=1000,exec,umask=0 0 0
So, rights seems ok but virtualenv returns me :
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 3, in <module>
virtualenv.main()
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 938, in main
never_download=options.never_download)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 1039, in create_environment
site_packages=site_packages, clear=clear))
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 1186, in install_python
copyfile(join(stdlib_dir, fn), join(lib_dir, fn))
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 430, in copyfile
copyfileordir(src, dest)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 405, in copyfileordir
shutil.copytree(src, dest, True)
File "/usr/lib/python2.7/shutil.py", line 206, in copytree
raise Error, errors
shutil.Error: [('/usr/lib/python2.7/config/libpython2.7.so', 'seb/lib/python2.7/config /libpython2.7.so', '[Errno 1] Operation not permitted')]
i've installed virtualenv with apt.
using virtualenv in my /home is successfull
can you help me ?
fixed. I don't exactly why, but i've formated my partiton with a ntfs type resolves the issue.
It seems that fat32 system adds control over fstab