1
If you use system site packages, problems can come when you ship your app on a different machine, where global environment can be very different from what you have locally, which causes lots of problems when deploying. Use clean virtual environment for every not only Django, but all Python projects.
0
Yes, system-wide packages can cause conflicts. Distro packages are sometimes outdated or are following LTS releases, and installing in a local environment the same package can lead to errors (some time ago I had a problem where django was installed with distro packages, and it was older than the one in my virtual environment, causing issues).
The rule I tend to follow while developing in python : only install Python on the distro. Then for each python project, use a virtual environment. This way you will never have a problem making projects.
- How is HttpResponseRedirectBase class being called when I call HttpResponseRedirect
- Unsupported operand type(s) for -=: 'str' and 'int'
- Chain filter query params
0
As I’ve written elsewhere, “Many people prefer their isolated environments to be, well, isolated, so they don’t use [--system-site-packages
], but I use it often in order to avoid compiling packages. pip install gdal
can take a long time because it needs to compile stuff, whereas apt-get install python-gdal
is way faster; so I use --system-site-packages
in order to be able to use the system-wide gdal (this issue is becoming less important now that most Python packages are distributed compiled, as a Python wheel). In addition, psycopg2 can be tricky to compile, and it is usually better to use the operating system’s version, which is usually guaranteed to work with the operating system’s postgresql. In Windows, however, I normally don’t use --system-site-packages
, as there are no site packages packaged with the operating system.”
I have never had conflicts nor any other problems. The operating system can often have outdated packages, but this is not a problem. If the operating system has pandas 0.17 and my Django project requires 0.19, when I type pip install -r requirements.txt
it will install 0.19, which will override the operating system’s package.
Note that I never run pip
system-wide; I always run it in a virtualenv. So my system-wide installation only has packages installed with apt-get
.
- Git- local master branch appears to be broken
- Unexpected Circular Dependency in migration files
- Access request from the forms.Form to get data from dB related to user
- Django render and validate formset in class based-view (ListView)