Running conda install as an admin on my ubuntu server, I get "Missing write permissions: /home/ubuntu/anaconda3" - python-3.x

I have installed Anaconda3 on my ubuntu server.
When I attempt to install or upgrade any package using conda, for example:
conda install numpy=1.11.0
(of course you cannot do "sudo conda")
I receive the following error:
Error: Missing write permissions in: /home/ubuntu/anaconda3
#
# You don't appear to have the necessary permissions to install packages
# into the install area '/home/ubuntu/anaconda3'.
# However you can clone this environment into your home directory and
# then make changes to it.
# This may be done using the command:
#
# $ conda create -n my_root --clone=/home/ubuntu/anaconda3

As #cel pointed out, providing the correct permissions is all that is necessary:
sudo chown -R ubuntu /home/ubuntu/anaconda3
sudo chmod -R +x /home/ubuntu/anaconda3

Related

Ubuntu 16.04 - (Oracle module for Python) - How to install 'cx_Oracle' module easy way?

I have Ubuntu 16.04 (on Docker) and wanted to connect to remote Oracle DB using Python. For that - using cx_oracle module.
Tried:
pip install cx_oracle
--> Complained about libaio1 and libaio-dev missing..
apt-get install libaio1 libaio-dev
--> Complained again:
cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "libclntsh.so: cannot open shared object file: No such file or directory"
Is there a one command to install cx_Oracle properly on Ubuntu 16.04 (or need to do all from source manually -> trying to automate all steps...)?
Thanks.
Did not find (yet) easy way but this is what I did:
This just worked for me on Ubuntu 16:
Download ('instantclient-basic-linux.x64-12.2.0.1.0.zip' and 'instantclient-sdk-linux.x64-12.2.0.1.0.zip') from Oracle web site and then do following script (you can do piece by piece and I did as a ROOT):
apt-get install -y python-dev build-essential libaio1
mkdir -p /opt/ora/
cd /opt/ora/
## Now put 2 ZIP files:
# ('instantclient-basic-linux.x64-12.2.0.1.0.zip' and 'instantclient-sdk-linux.x64-12.2.0.1.0.zip')
# into /opt/ora/ and unzip them -> both will be unzipped into 1 directory: /opt/ora/instantclient_12_2
rm -rf /etc/profile.d/oracle.sh
echo "export ORACLE_HOME=/opt/ora/instantclient_12_2" >> /etc/profile.d/oracle.sh
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME" >> /etc/profile.d/oracle.sh
chmod 777 /etc/profile.d/oracle.sh
source /etc/profile.d/oracle.sh
env | grep -i ora # This will check current ENVIRONMENT settings for Oracle
rm -rf /etc/ld.so.conf.d/oracle.conf
echo "/opt/ora/instantclient_12_2" >> /etc/ld.so.conf.d/oracle.conf
ldconfig
cd $ORACLE_HOME
ls -lrth libclntsh* # This will show which version of 'libclntsh' you have... --> needed for following line:
ln -s libclntsh.so.12.1 libclntsh.so
pip install cx_Oracle # Maybe not needed but I did it anyway (only pip install cx_Oracle without above steps did not work for me...)
Now python scripts are ready to use 'cx_Oracle'.

Error in creating virtualenv in ubuntu 16.04.2 LTS

Hello I am getting following error during virtualenv creation.
Here is the error:
$ mkvirtualenv cv
ERROR: virtualenvwrapper could not find /usr/local/bin/virtualenv in your path
Before this I was getting some weird message during the run of following commands:
sudo python get-pip.py
sudo pip install virtualenv virtualenvwrapper
Here is the weird message:
The directory '/home/myusername/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/myusername/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
If I run this command sudo apt install virtualenv or virtualenvwrapper then I don't get the above weird message. but this don't help me to create virtualenv
python path is /usr/bin/python
Can anybody help me to figure out the issue by providing detailed command?
First, let's clear your "weird" message. It means that you've already used sudo -H before and sudo changed ownership for some of your files to root. Take the files back with the command
sudo chown -R myusername /home/myusername
(change myusername to your real login name; I used the name you've used in your question.)
After that upgrade pip and follow installation instructions for virtualenv and virtualenvwrapper:
sudo pip install -U pip setuptools virtualenv virtualenvwrapper
source /usr/local/bin/virtualenvwrapper.sh

sudo: command not found when I ssh into server

I am a newbie with server handling and Linux. I am trying to install composer on my server so that i can host my Laravel project onto it as mentioned in the tutorial in Ultimate Guide: Deploy Laravel 5.3 App on LEMP Stack. I ssh into the server and after installation of composer when I run sudo mv composer.phar /usr/local/bin/composer I am getting a message in the terminal:
-bash: sudo: command not found
I desperately need some deliberate help
Sudo is probably not installed or not in your path
check to see if you are root in this case sudo is not needed unless you are trying to impersonate another user. just run your command without sudo mv composer.phar /usr/local/bin/composer
See if sudo is your path by running which sudo or echo $PATH. If sudo is not in your path, your path variable might be broken. You can try testing this by executing a common location for sudo /usr/bin/sudo or running locate sudo | grep bin to attempt to find its location.
If you know that sudo was installed, or your path looks broken, try fixing your path. Check your distribution's env file (/etc/environment in ubuntu) to make sure that it is formatted correctly (script commands are illegal in this file)
If you are not root and you want to run a command with root prvileges then you must install sudo. But if you don't have sudo and you are not root then you can't install it. In this case I recommend switching to the root user with su
If you do not have the root password and you own the machine, you can reset the root password with a tutorial such as https://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password
After you manage to login as root install sudo with apt-get update; apt-get install sudosince you are using Ubuntu.
Verify the the name of your sudoers group with visudo and modify your sudoers file if you need to. https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos
if you have an existing sudoers group or you create one you can add yourself to the group. For example if your sudoers group is called sudo run usermod -aG sudo myuser. The sudoers group by default in Ubuntu based Linux is sudo. A sudoers group entry looks like this: %sudo ALL=(ALL:ALL) ALL
If you are trying to impersonate another user and cannot install sudo, you can still use su if it is installed and you have permission / password for the other user.
e.g. su someuser
As suggested in this post, you may have to install sudo in your server.
To do that, log in as root with the following command: su -. Then install sudo with your package manager (if you're in Ubuntu: apt-get install sudo).
Then add your user to the sudo group: usermod -aG sudo <username>.
Finally type exit to log out of the root account and go back to your user.
try to install your sudo using by first logging in as a root(su - ) and then try to install **apt-get or yum sudo **. Make sure your path variable is set so that you would be able to get binary.
which sudo
echo $PATH

Can't find Python.h when compiling PyCaffe on Ubuntu 14.04

I'm trying to install PyCaffe for Python 3.5.3 on AWS EC2 with Ubuntu 14.04 without Anaconda, following the installation instructions.
I successfully compiled it on the same machine for Python 2.7 but when compiling for version 3.5 I get the following error:
ubuntu#ip-172-31-3-227:~/caffe$ make pycaffe
CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory
#include <Python.h> // NOLINT(build/include_alpha)
I saw this post and performed:
sudo apt-get install python3-dev
I found this, so I performed the equivalent command for Python 3.5:
for req in $(cat requirements.txt); do sudo pip3.5 install $req; done
All installations worked but it didn't fix the problem.
I many other posts on similar problems but not this exact problem (so if you find something please check that it's really the same situation before rushing to say I didn't look well enough).
P.S.
I also saw this post but I don't understand which directories to add to the path.
When you do a pip install package,when pip finds new version,it uninstall the current one(dateutil in your case) when the package was installed using certain permission,pip needs the same permission to uninstall/upgrade it.
A quick fix would be to change this
`for req in $(cat requirements.txt); do pip3.5 install $req; done` to
for req in $(cat requirements.txt); do sudo pip3.5 install $req; done
It seems you dont have permission to access /usr/local/lib/python3.5/ folder as user,the packages that goes in /usr/local are required by the system but only available to you and only you on the system, i assume since only only they are restricted to you and pip want to access assuming that no restriction is there,then it get permission denied ,so you might consider doing
for req in $(cat requirements.txt); do pip3.5 --user yourusername install $req; done
the alternative is to remove any restriction to execute and write on that folder
by doing chmod -R 777 /usr/local/lib/python3.5/ which is usually not recommended but the problem you need pip to be able to read,write,execute anything in that folder.

can't install nvm on linux 14.04

I just fired up a new EC2 instance on Amazon and I'm trying to install nvm. I tried running their install script with the NVM_DIR=... for a global install:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | NVM_DIR=/usr/local/nvm bash
but I get this error:
=> Downloading nvm from git to '/usr/local/nvm'
=> mkdir: cannot create directory ‘/usr/local/nvm’: Permission denied
I get this error with sudo as well. I also tried going into usr/local and making the nvm directory manually, but then i get other errors like this:
=> Cloning into '/usr/local/nvm'...
/usr/local/nvm/.git: Permission denied
Does anyone know why this is happening? Is it a permissions thing on aws I am unfamiliar with?
Edit: using a much older version without the NVM_DIR stuff worked. I still want global access though, so this does not solve the problem
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
Your normal user won’t have access to write to /usr/local, so you’ll need to run the install script as root/sudo.
Your curl command is fine to run as your user. In fact, it’s best to just curl the file to a local location before running it, so you can eyeball it -- unless you have reason to believe it is a very trustworthy script. So grab the install.sh script:
% curl -O https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh
% $EDITOR install.sh # feel free to look it over
Then install it with sudo:
% sudo -i # become root temporarily
# export NVM_DIR=/usr/local/nvm # set the environment variable
# bash install.sh # run installer as root
# exit
%
(There is a way to make the whole installation a one-liner, passing the environment variable through sudo, but I don't think it's necessary, and a little more complex, IMHO.)

Resources