Cant install pip virtualenv virtualenvwrapper opencv3 python2.7 ubuntu - python-2.7

I'm new to Ubuntu and OpenCV. I'm trying to use this tutorial to get started. However, in steps 7 and 8 I can't install pip:
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
What should I do? I get this error:
The directory '/home/renzo/.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/renzo/.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.
/tmp/tmpUEma37/pip.zip/pip/vendor/requests/packages/urllib3/util/ssl.py:315: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
/tmp/tmpUEma37/pip.zip/pip/vendor/requests/packages/urllib3/util/ssl.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages/pip-8.1.1-py2.7.egg

First thing to do is get ownership of that directory. In general, all files in your home directory (/home/renzo ) should be owned by the user (renzo in your case), but to address your problem specifically, take ownership of the .cache folder:
chown -R renzo /home/renzo/.cache
You may need to prefix it with sudo, i.e.:
sudo chown -R renzo /home/renzo/.cache
The -R makes it recursive, renzo is your username, and the hidden dotfile (actually folder) is .cache
Once you've done that, try the install command again.

Related

Move Redmine Server whilst keeping external database

I currently have redmine running on an nginx server. The actual MySQL database is on an external server and everything is working fine.
Now I would like to move it to an Apache Server on a different machine, ideally without changing/moving the database.
Is this possible, or do I always need to export/import the database regardless? Happy to stick with the same version of redmine (in my case 4.0.1., Ruby 2.5.1-p57, Rails 5.2.2, no plugins installed). If positive, what are the conditions on Ruby/Rails versions? Do they all have to be exactly what I had on the old one?
Database scheme is not affected by ruby version, only by Redmine's version, because new versions might add or remove stuff in database.
So in your case, copy-pasting your old Redmine to new server should work.
However you must ensure that new Redmine server (probably new IP) has proper privileges to access MySQL database.
And you must follow upgrade tutorial, because your new server needs to pull and install Ruby Gems, clear old cache from tmp folder etc...
https://www.redmine.org/projects/redmine/wiki/RedmineUpgrade
Aleksander's answers gave me confidence that it can be done, but I ended up persevering with my initial approach until I got that working rather than changing to his proposals.
I am afraid that I lost track of the sources for various bits, its primarily from the redmine help pages.
My complete solution was
sudo apt update
sudo apt upgrade
sudo apt install build-essential libmysqlclient-dev imagemagick libmagickwand-dev ruby-full
sudo apt install apache2 libapache2-mod-passenger
sudo gem update
sudo gem install bundler
sudo curl -L https://www.redmine.org/releases/redmine-4.0.1.tar.gz -o /tmp/redmine.tar.gz
sudo tar zxf /tmp/redmine.tar.gz
sudo mv redmine-4.0.1 /opt/redmine
sudo touch /opt/redmine/Gemfile.lock
sudo chown www-data:www-data /opt/redmine/Gemfile.lock
sudo chmod a+w /opt/redmine/Gemfile.lock
sudo cp /opt/redmine/config/database.yml.example /opt/redmine/config/database.yml
sudo ln -s /opt/redmine/public /var/www/html/redmine
cd /opt/redmine
mkdir -p /opt/redmine/app/assets/config && echo '{}' > /opt/redmine/app/assets/config/manifest.js
bundle install
bundle exec rake generate_secret_token
Note the manifest line above only applies to my particular redmine version which was incompatible with later sprockets versions. Also note that changing the permissions a+w is possibly excessive, but I struggled with permissions otherwise.
Then we have to do a few more manual tweaks. Open the file with your text editor:
sudo nano /opt/redmine/config/database.yml
and change production to be the following
production:
adapter: mysql2
database: myredminedatabasename
host: mysqlserver.somewhere.com
username: dbusername
password: "dbpassword"
encoding: utf8
Need to add the PassengerDefaultUser line to /etc/apache2/mods-available/passenger.conf (leave the other two lines the same even if slightly different)
<IfModule mod_passenger.c>
PassengerDefaultUser www-data
PassengerRoot /usr
PassengerRuby /usr/bin/ruby
</IfModule>
Change /etc/apache2/sites-available/000-default.conf to insert the following with the other sections so that apache knows to follow the symlink into Rails. Also note the first line setting DocumentRoot, which was oone of my personal stumbling blocks.
DocumentRoot /var/www/html/redmine
<Directory /var/www/html/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
We also need to copy the contents of files folder from /opt/redmine/files on older server to the new server in same location.
Also copy the email settings across in /opt/redmine/config/configuration.yml.
Then restart your server and it should be working.

Could not install packages due to an EnvironmentError in ec2 server

i'm typing the following in my working amazon ec2 linux server. (with ENV activated)
pip install pillow
getting this error:
Could not install packages due to an EnvironmentError:
[Errno 13] Permission denied: '/home/ec2-user/env/lib64/python3.5/site-packages/Pillow-5.1.0.dist-info'.
Consider using the `--user` option or check the permissions.
if i use --user i get:
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Based on your answers, what happened is that you used sudo when you created the virtualenv so root owns it.
sudo chown ec2-user:ec2-user -R ~ec2-user/env will fix this and make ec2-user the owner of the directory (and subdirectories) again.

Virtual Environment installation Error

When I try to install a virtual environment in my local system I'm getting this error. Could you please help me out to fix this issue?
$ pip -V
pip 9.0.1 from /home/sysadmin/.local/lib/python2.7/site-packages (python 2.7)
$ sudo pip install virutalenv
sudo: unable to resolve host sysadmin-Veriton-M200-H61
The directory '/home/sysadmin/.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/sysadmin/.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.
Collecting virutalenv
Could not find a version that satisfies the requirement virutalenv (from versions: )
No matching distribution found for virutalenv
You have a typo there. It's virtualenv, not virutalenv.
Also, since you already have pip installed in .local, please don't install virtualenv using sudo.
Just
$ pip install --user virtualenv
should do, and virtualenv will be available in your user directory (~/.local/bin if memory serves, but find ~ -type f -name virtualenv will find it for you).

I already have python 2.7 install plus 3.6 install but when I try to install Django it give me the following error

The directory '/Users/sandeepkrishnan/Library/Caches/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 '/Users/sandeepkrishnan/Library/Caches/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.
Requirement already satisfied: django in /Library/Python/2.7/site-packages
You're installing Django into Python 2.7 instead of 3.6, but you already have it installed in 2.7. To install it in Python 3.6, try pip3 install django and see if that works.

Permissions warning with sudo pip install

I am using an ubuntu 14.04 64bit machine. The system python is 2.7.6.
This is what happens when I try to pip install anything
thekindlyone#deepthought:~$ sudo pip install pyopenssl
The directory '/home/thekindlyone/.cache/pip/log' or its parent directory is not owned by the current user and the debug log 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/thekindlyone/.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/thekindlyone/.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.
Requirement already satisfied (use --upgrade to upgrade): pyopenssl in /usr/lib/python2.7/dist-packages
pip is at 6.1.1
How do I get rid of these warnings?
Perhaps you want to use the sudo '-H' option to set the HOME environment variable to the home directory specified by the target user's password database entry.
That way, pip will use a cache directory in your root users home.
eg.
$ sudo -H pip install pyopenssl