Getting python path associated with default python version:
python -c 'import sys, pprint; pprint.pprint(sys.path)'
Semicolons to delimit lines, pprint to make the output pretty, sys.path to see what will actually be called.
In my case I learned that my virtual environment version of python is calling libraries outside of that environment.
Recursive algorithms can be slow because they end up solving the same little problems over and over again. To speed them up, you can use a technique called "memoization." Memoization allows algorithms go much more quickly by remembering solutions to problems they have already solved. I’m the recursive algorithm. This blog is my memoization.
Showing posts with label virtualenv. Show all posts
Showing posts with label virtualenv. Show all posts
Friday, November 7, 2014
Wednesday, November 5, 2014
Lessons learned: don't remove python3 on Ubuntu. Also, how to get a python3 virtual environment with ubuntu 14.4
I was trying to create a virtual environment for python3.4 when I ran into the problem described here:
https://lists.debian.org/debian-python/2014/03/msg00045.html
Apparently, python 3.4 is deliberately broken by default in a way that pops up when you try to set up the virtual environment in the ordinary way. To quote the source:
https://lists.debian.org/debian-python/2014/03/msg00045.html
Apparently, python 3.4 is deliberately broken by default in a way that pops up when you try to set up the virtual environment in the ordinary way. To quote the source:
The current situation in the Python 3.4 package
is suboptimal because: % pyvenv-3.4 /tmp/zz Error: Command '['/tmp/zz/bin/python3.4',
'-Im', 'ensurepip', '--upgrade', '--default-pip']'
returned non-zero exit status 1
The bottom line in the quote above provided the key solution. But only after my big mistake.Although `virtualenv -p python3.4 /tmp/zz` does work.
My big mistake: removing python3
apt has me so spoiled that instead of turning to Google with the error message, I tried removing python3 with the plan to then reinstall it. It was while watching the messages pour out of package after package being removed that I realized my mistake. I had pulled out a critical part of the modern ubuntu environment and everything built on top of it was being removed. So I'm backing up all files on that installation and re-installation is coming soon.nginx, postgresql, django, virtualenv
Nice tutorial here on Digital Ocean:
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn
The instructions fell apart a bit once I got to the section configuring postgres. Basically, when I expected to see a query about a role name it skipped that and started asking me about a password.
So for the configuration of postgres on Ubuntu, I recommend skipping over to https://help.ubuntu.com/community/PostgreSQL .
After that I went back to the guide.
I found that since I was using python3 and because of a bug in 'pip' where it wants to install things globally, I had to change the
'pip install psycopg2' inside my virtual environment to
'pip3 install psycopg2' to get a local installation with python3.
Next, there is a depracated command in the tutorial that no longer works.
Replace
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn
The instructions fell apart a bit once I got to the section configuring postgres. Basically, when I expected to see a query about a role name it skipped that and started asking me about a password.
So for the configuration of postgres on Ubuntu, I recommend skipping over to https://help.ubuntu.com/community/PostgreSQL .
After that I went back to the guide.
I found that since I was using python3 and because of a bug in 'pip' where it wants to install things globally, I had to change the
'pip install psycopg2' inside my virtual environment to
'pip3 install psycopg2' to get a local installation with python3.
Next, there is a depracated command in the tutorial that no longer works.
Replace
gunicorn_django --bind yourdomainorip.com:8001
withgunicorn myapp.wsgi:application --bind yourdomainorip:8001
Subscribe to:
Posts (Atom)