I'm on Mac OS 10.9 and running Python 3.5.2
I tried updating conda
conda update conda
but it gave me this error
Traceback (most recent call last):
File "/Users/cd/anaconda3/bin/conda", line 6, in <module>
sys.exit(main())
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/cli/main.py", line 139, in main
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/cli/main.py", line 146, in args_func
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/cli/main_update.py", line 64, in execute
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/cli/install.py", line 424, in install
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/plan.py", line 539, in execute_actions
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/instructions.py", line 149, in execute_instructions
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/instructions.py", line 92, in LINK_CMD
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/instructions.py", line 88, in link
File "/Users/cd/anaconda3/lib/python3.5/site-packages/conda/install.py", line 634, in link
File "/Users/cd/anaconda3/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users/cd/anaconda3/etc/fish/conf.dā
I searched around and thought the problem was that I needed to chown the folder with my user (which is 'cd' in my case):
sudo chown -R cd anaconda3
Then I tried conda update conda, but now it gives a different error:
zsh: /Users/cd/anaconda3/bin/conda: bad interpreter: /opt/anaconda1anaconda2anaconda3/bin/python3: no such file or directory
I tried putting chownback to root:
sudo chown -R root anaconda3
but when I tried conda update conda it gave me the same "bad interpreter" error.
where conda gives /Users/cd/anaconda3/bin/conda
I don't know if the problem was the chowncommand or not, but please let me know if you need any more details!
Your shebang line in /Users/USER/anaconda/bin/conda is broken:
#!/opt/anaconda1anaconda2anaconda3/bin/python
just switch it back to point to the link of your install of Anaconda:
#!/Users/USER/anaconda/bin/python
Related
I have several bash scripts that I define in the crontab planner to run. This is what the script looks like:
#!/bin/bash
source /home/administrator/anaconda3/bin/activate
python /share/****/VK_RU_YAR.py
conda deactivate
As you can see, anaconda is installed under the administrator. But I myself work under a different user, but I have sudo rights. How can I apply them correctly in the script so that everything works.
Error:
Could not find conda environment:
You can list all discoverable environments with `conda info --envs`.
Traceback (most recent call last):
File "/share/RosAtom-V/Work/VK_RU_YAR.py", line 17, in <module>
from check_size import checking
File "/share/RosAtom-V/Work/check_size.py", line 6, in <module>
set_log(log_conf)
File "/share/RosAtom-V/Work/clogs.py", line 4, in set_log
fileh = logging.FileHandler(file, 'a')
File "/home/administrator/anaconda3/lib/python3.8/logging/__init__.py", line 1143, in __init__
StreamHandler.__init__(self, self._open())
File "/home/administrator/anaconda3/lib/python3.8/logging/__init__.py", line 1172, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/share/RosAtom-V/Logs/log_script.txt'
Separate execution of the python script does not cause errors.
I am learning Django with python 3.6. I use Ubuntu 18.04.2 LTS which is also new for me. My pip version is 9.0.1. My problem is when I try to create virtual environment on my external exFAT had drive with virtualenv myenv command it gives the error that I shared bellow. But I can create virtual environment on the Desktop with the same command. The problem is very weird for me. I can't solve the problem. Can you guys please help me? Thanks in advance!
SAMPLE CODE: ERROR
c#p:/media/c/2NDTB/testpro$ virtualenv myenv
Using base prefix '/usr'
Traceback (most recent call last):
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 417, in copyfile
os.symlink(os.path.realpath(src), dest)
OSError: [Errno 38] Function not implemented: '/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu' -> '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/c/.local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 831, in main
symlink=options.symlink,
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 1106, in create_environment
install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 1390, in install_python
copy_required_files(stdlib_dir, lib_dir, symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 1300, in copy_required_files
copyfile(join(src_dir, fn), join(lib_dir, fn), symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 420, in copyfile
copy_file_or_folder(src, dest, symlink)
File "/home/c/.local/lib/python3.6/site-packages/virtualenv.py", line 398, in copy_file_or_folder
shutil.copytree(src, dest, symlink)
File "/usr/lib/python3.6/shutil.py", line 359, in copytree
raise Error(errors)
shutil.Error: [('/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so', '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so', "[Errno 38] Function not implemented: '../../x86_64-linux-gnu/libpython3.6m.so.1' -> '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6m.so'"), ('/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so', '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so', "[Errno 38] Function not implemented: '../../x86_64-linux-gnu/libpython3.6m.so.1' -> '/media/c/2NDTB/testpro/myenv/lib/python3.6/config-3.6m-x86_64-linux-gnu/libpython3.6.so'")]
I see two problems in what you are trying to do. The first, smaller problem is that FAT doesn't implement symlinks and virtualenvs by default use symlinks to that version of python they have been created with. You can try virtualenv --always-copy to avoid symlinks.
But then you get to the second, bigger problem You're trying to create a virtualenv on a removable drive to port it somewhere. That doesn't work ā virtualenvs are not relocatable. When you need a virtualenv at a different place you have to recreate it. To copy the list of installed packages from one virtualenv to another run this in the original virtualenv:
pip freeze >requirements.txt
then move file requirements.txt to the other place, create a new virtualenv and restore packages:
virtualenv venv2
source venv2/bin/activate
pip install -r requirements.txt
I'm trying to use pip to uninstall numpy(I also installed pandas, but I seem to have been able to uninstall that). In the case of `numpy, I get the following output.
pip3 uninstall numpy -vvv --log pip.txt
Uninstalling numpy-1.12.1:
/usr/lib64/python3.6/site-packages/numpy
/usr/lib64/python3.6/site-packages/numpy-1.12.1-py3.6.egg-info
Removing file or directory /usr/lib64/python3.6/site-packages/numpy
Exception:
Traceback (most recent call last):
File "/usr/lib64/python3.6/shutil.py", line 544, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/usr/lib64/python3.6/site-packages/numpy' -> '/tmp/pip-odkg0wo0-uninstall/usr/lib64/python3.6/site-packages/numpy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.6/site-packages/pip/commands/uninstall.py", line 76, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 346, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib64/python3.6/shutil.py", line 556, in move
rmtree(src)
File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'multiarray_tests.cpython-36m-x86_64-linux-gnu.so'
I've got a Fedora 26 system running both Python 2.7.15 and Python 3.6.5
I'm very new to Python (just started learning it last night), so forgive the ignorance. I've seen several related questions (mostly dealing with pip installs rather than uninstalls. None of them seemed to solve the issue. I should also note that I've read in these other posts that running pip as sudo is a bad idea (something I did while trying to install pandas because I didn't have permissions (and again, I read later on that that is a bad idea). Any help here is appreciated.
For python3:
sudo pip3 uninstall numpy
For python:
sudo pip uninstall numpy
or using:
sudo apt-get remove python-numpy
I had a similar problem with numpy and I just had to remove the package using apt (In your case is yum).
Try to do:
sudo yum remove python3-numpy
Try running it with root authorization
sudo pip3 uninstall numpy
It should work, most of the times.
in your case
sudo apt remove python-numpy
and
sudo pip install numpy==[Version you need]
When trying to sudo pip install django-nose, I get a strange error:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/commands/install.py", line 347, in run
root=options.root_path,
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_set.py", line 549, in install
**kwargs
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 754, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 963, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 266, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 176, in clobber
os.makedirs(dest)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 2] No such file or directory: ''
I am only using sudo because without sudo, I get a IOError: [Errno 13] Permission denied: '/lib/python2.7/site-packages/nose/__init__.py'. Here is what I get for which Python and pip is being used, which I think are both what I want them to be:
$ which python
/usr/local/bin/python
$ which pip
/usr/local/bin/pip
This is a separate issue, but I wonder if it's related: I also get this error while trying to create a virtualenv: IOError: [Errno 13] Permission denied: '/lib/python2.7/site-packages/easy_install.py'
I recently upgraded to El Capitan, and it seems like there were some permissions changes that may have caused it to suddenly not work even though it has been working for a while. (Although I'll admit I'm not super experienced here, so I could be doing something very obviously wrong.) I just have no idea how to even decipher this error, and obviously I don't want to do any chmod or chown on system files unless I absolutely know it will solve my problem. Any suggestions would be greatly appreciated!
Installing CKAN locally on OSX 10.9, based on http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html.
I've created and activated the python virtualenv and now need to create a CKAN config file:
$ paster make-config ckan /etc/ckan/default/development.ini
The output is as follows (ImportError at the last line):
Distribution already installed:
ckan 2.2 from ~/ckan/lib/default/src/ckan
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 68, in run
return super(AbstractInstallCommand, self).run(new_args)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 295, in command
self.distro, self.options.ep_group, self.options.ep_name)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 234, in get_installer
'paste.app_install', ep_name)
File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2302, in load_entry_point
return ep.load()
File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "~/ckan/lib/default/src/ckan/ckan/config/install.py", line 3, in <module>
from pylons.util import PylonsInstaller
ImportError: No module named pylons.util
I'm not sure how to proceed, any ideas?
ImportError: No module named pylons.util looks like Python cannot find the Pylons package, one of the Python packages that CKAN depends on. Two possibilities come to mind:
Did you activate your CKAN virtualenv, before running the paster command? ~/ckan/default/bin/activate.
Have you installed the Python packages that CKAN depends on into your virtualenv? With the virtualenv activated run pip install -r ~/ckan/default/src/ckan/requirements.txt
If you activate your CKAN virtual environment and then run pip freeze | grep pylons, this should tell you whether pylons is installed in the virtualenv.
The Distribution already installed: at the top of your terminal output is strange.
I had the same error and a slightly different solution:
got the error only after using sudo, so I went out of it (sudo -k)
then I got the following error: IOError: [Errno 13] Permission denied: '/etc/ckan/default/development.ini'
after digging around a lot, I finally found out that while the /etc/ckan had correct permissions, it was actually a symlink to ~/ckan/etc and that folder did not have correct permissions
I ran sudo chown -R `whoami` ~/ckan/etc and followed up with paster make-config ckan /etc/ckan/default/development.ini