I am trying to install anaconda for all the users on ubuntu 18.04. I installed anaconda at /root/anaconda3.
After that i edited the path in in /etc/environment to include the anaconda path.
When i login as a user i can see the path as
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/root/anaconda3/bin:/snap/bin: No such file or directory
I dont know why the No such file or directory is showing up.
when i try to run python it does not detect python.
Command 'python' not found, but can be installed with:
apt install python3
apt install python
apt install python-minimal
Ask your administrator to install one of them.
You also have python3 installed, you can run 'python3' instead.
I want to use anconda's python. I am able to use anaconda python as root user but not as other users. how do i make it work for all users?
Typically, /root is the root user's home directory and is accessible to root user only. One way to overcome the issue is to change the permissions of this root directory.
sudo chmod -R 777 /root
Be warned though that doing this not advised since changing files that are critical to system may cause it to become unstable.
Other way is to install anaconda in a different directory and assigning permissions to the install directory. The instructions to do that can be found on this link.
Hope this helps.
Related
Whenever I try to install a new python package I get this message first :
Defaulting to user installation because normal site-packages is not writeable
even though I have administrator rights and I am running my py scripts and installation commands on my computer.
Any ideas why I keep getting this message before every and each pip installation?
Thanks in advance
While this most likely is to be avoided, the only option I found to work is to use the --ignore-installed switch such as:
pip install -U --ignore-installed python-openstackclient
as root which allowed python to overwrite all old distro files with the correct new versions.
This is an old question, but it mirrored my problem well. After running python3 -m virtualenv myproject, it created myproject/local/bin/activate instead of myproject/bin/activate, and after sourcing this file, pip3 install some_package would report Defaulting to user installation because normal site-packages is not writeable and proceed to install packages as the user rather than the virtual environment.
The fix for both issues was:
sudo pip3 uninstall virtualenv
sudo apt install -y python3-virtualenv
This second command will be different for non-Debian distributions.
I had this problem. you can copy packages file to AppData>Roaming>Python>Python3.(X)>script directory
work for me!
first I need to ask when you open cmd, is python added to path? when you type 'python' in cmd does something happen? If not, try to add python to path, otherwise if that doesn't work, try re-installing python. Also which version of python do you have? Does this happen with every package you try to install? Finally if nothing works, try to change the download location of python, and run cmd as admin/without admin, try both.
For anyone who does not wanna reinstall python, if u get the defaulter message, then all you have to do is go to AppData>Roaming>Python>Python3.(X)>site-packages. Cut the folders that are related to the package(U can identify by seeing the date modified), and paste the folders in originally installed python.exe destination then>Lib>site-packages. Hopefully when you restart the code editor modules will work. I did this and it worked.
I have a Linux machine with Ubuntu rel 20.10, I'm using the robot framework with Eclipse. I have a problem with a Sikulilibrary
doesnt'work. I tried to pip install robotframework-SikuliLibrary,
But i have this error
> Exception : Initializing test library Sikulilibrary with no arguments
> failed:Permission error[Errno13]Permission denied
I tried to install Selenium library all is ok,do you have any questions about this issue?
Robotframework 3.2
Python 3.8.6
Thanks a lot
pip wants to install the package in your system, and you don't have the right to write here. But... Do NOT use sudo with pip. This will install system-wide and can break your installation or a package can overwrite this one.
Use virtualenv, or pipenv.
E.g. To use virtualenv:
cd your-project
python -mvenv .venv
source .venv/bin/activate
# and then
pip install XXX
You will need to call source .venv/bin/activate anytime you want to work and launch your project. The behavior is to change the installation path to a local path (and not your system).
Or, like said #BIOS in https://stackoverflow.com/a/66785567/1472048 comment, use your "home" installation with "--user" option to install in ~/.local/lib.
Make sure that you are adding the module in the correct Python installation (your Python 3.8 and not the system Python) and that you are installing in your home directory. This way no special permission will be needed.
pip3 install --user robotframework-SikuliLibrary
The above will install the package in the user site-packages directory of the current (running) Python. In my case it is ~/.local/lib/Python3.9/site-packages, which is already in my PATH. It should be the case for you too, so you should be good to go.
Otherwise, if you have problems like ModuleNotFoundError just find your site-packages directory with:
python3 -m site
You will have it under USER_SITE. Take note of it and add it to PATH following help from this question.
Otherwise, like #Metal3D said, you could use a virtual environment
Whenever I try to install a new python package I get this message first :
Defaulting to user installation because normal site-packages is not writeable
even though I have administrator rights and I am running my py scripts and installation commands on my computer.
Any ideas why I keep getting this message before every and each pip installation?
Thanks in advance
While this most likely is to be avoided, the only option I found to work is to use the --ignore-installed switch such as:
pip install -U --ignore-installed python-openstackclient
as root which allowed python to overwrite all old distro files with the correct new versions.
This is an old question, but it mirrored my problem well. After running python3 -m virtualenv myproject, it created myproject/local/bin/activate instead of myproject/bin/activate, and after sourcing this file, pip3 install some_package would report Defaulting to user installation because normal site-packages is not writeable and proceed to install packages as the user rather than the virtual environment.
The fix for both issues was:
sudo pip3 uninstall virtualenv
sudo apt install -y python3-virtualenv
This second command will be different for non-Debian distributions.
I had this problem. you can copy packages file to AppData>Roaming>Python>Python3.(X)>script directory
work for me!
first I need to ask when you open cmd, is python added to path? when you type 'python' in cmd does something happen? If not, try to add python to path, otherwise if that doesn't work, try re-installing python. Also which version of python do you have? Does this happen with every package you try to install? Finally if nothing works, try to change the download location of python, and run cmd as admin/without admin, try both.
For anyone who does not wanna reinstall python, if u get the defaulter message, then all you have to do is go to AppData>Roaming>Python>Python3.(X)>site-packages. Cut the folders that are related to the package(U can identify by seeing the date modified), and paste the folders in originally installed python.exe destination then>Lib>site-packages. Hopefully when you restart the code editor modules will work. I did this and it worked.
I installed python via Anaconda to my /opt directory (I heard that's the proper way when all users should be able to use it).
Everything is working fine so far, up to the point when I try to install packages via pip or conda. Than I get permission issues for both ways.
When I try to do:
sudo pip install pandas-datareader
I get:
sudo: pip: command not found
and the same error results if I try to use conda as well.
Does anyone have an idea how to fix that?
The /opt folder is not in the global path, so when you sudo it is not available.
You may want to sudo -E to preserve any environment variables, which will likely include a customization to the PATH variable to include the directory where pip is installed in /opt
Alternatively, you can give the full path to the command sudo /opt/anaconda-path/bin/pip
You don't need to run conda or pip with sudo. Just run pip install pandas-datareader.
You are getting that error because 'sudo' uses its own secure path and not user's path determined by bash environment variable PATH. sudo's secure path is mentioned in the /etc/sudoers file by a variable named "secure_path".
In order for the sudo to see pip/conda, you should ask your administrator to add "/opt/anaconda/bin" to the secure_path variable.
That should fix the issue. Hope it was helpful.
Here is what a typical sudoers file may look like:
enter image description here
I'm trying to install setuptools for Python2.7 on a Centos 6 VPS with Digital Ocean using this tutorial. When I reach the step where you "Intall setuptools using the Python we've installed (2.7.6)", I get this error:
[username#hotsname setuptools-1.4.2]$ python2.7 setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/test-easy-install-1111.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again.
Now, I previously followed instructions on the same digital ocean community site to give the user executing the above root privileges. When I try to use sudo to do this task, I get:
[username#hostname setuptools-1.4.2]$ sudo python2.7 setup.py install
[sudo] password for username:
sudo: python2.7: command not found
So I'm a little confused. I feel like I'm probably missing something simple. Digital Ocena was unable to provide further support on this. I've worked with virtualenv for a long time and am familiar with what to do once I get it installed, I'm just stuck here as it's my first time setting up a Centos host. Can you tell what I'm missing?
Thank you!
Changing to root user did the trick. Thanks CasualDemon.
Nowadays, if you'd like to install setuptools & pip easily, you can run this file with your python interpreter:
get-pip.py
You made need administrator (root) privileges for installing it to your system python (e.g sudo python get-pip.py.
Afterwards you can upgrade pip and/or setuptools through e.g:
$ pip install -U setuptools
$ pip install -U pip
I recommend for most python development you only install setuptools, pip, and virtualenv as root (or purely virtualenv, if you're being conservative). After, you can use virtualenv virtual environments to create isolated python environments which don't need to install to the system python or affect its installed packages. That way no other python (and/or pip invocations) needs to be run as root.