After installation module django version switched to lowest version - python

I am working on project which use django as main project library. I faced with a need to install for this project new module django-inspect-model and django-inspect after playing with both i understood that these modules aren't appropriate solutions for me and i uninstall them by
pip uninstall django-inspect-model
I don't remember but when i was installing one of these modules i saw in console message about compatibility with my django version but i didnt pay attention for it. Because module was succesfully installed and after deinstallation both of them i tried to run
python manage.py shell
which didn't run and printed in console that some of my installed modules imporerly configured for example celery. After googling message about error i understand that this kind of errors rise due to incompatibility with django and i decided to check my django version by
python -c "import django;print(django.__version__)"
Which promted me that installed django version is 1.8.6 but i exactly knew that before above described actions my django's version was 2.2.0
After checking of my requirements.txt file there isn't a doubt that installed django version was 2.2.0. How it's possible that installed module can switch django on lowest version than it was? Is here anyone who faced with the same situation ? What if i only upgrade my project installed modules (django too) using the same requirements.txt? I am afraid that my actions can broke my whole project

While installing some packages, Django switches to lower versions due to compatibility issues. In case you want the previous version back, you need to upgrade your Django with the following command:
python -m pip install -U Django
or
pip install --upgrade django

Related

Python modules not found even though installed

Python Version: 3.2.3
I've spent hours working on this issue and I'm still scratching my head furiously out of confusion. I'm testing an application built with python in a windows 7 device. I went and installed python and its dependencies. I also installed pip and the following packages: mysql-connector, and mysqlclient. However, when I tried running the script that imports mysql.connector, the debugger returns:
import mysql.connector
ImportError: No module named mysql.connector
I went and check the list of packages via pip list and saw that the packages we're definitely installed. They are listed as:
mysql-connector-python 8.0.26
mysqlclient 2.0.3
So, I compared this with my windows 10 device that has the script running without issues and saw that the packages were also installed the same way. I thought there were no issues in the package installation.
However, when I checked the python modules in help("modules"), I found something. The mysql and pip are not listed in the windows 7 device whereas, in my personal device, they were there.
I tried uninstalling and reinstalling the packages, yet the issue remains. For some reason, python is not able to detect the packages. I also tried to upgrade the pip via python -m pip install --upgrade pip and as expected, the python can't find the pip. I'm honestly confused at this point. Am I missing something?
UPDATE
It might be worth noting that, since my python version has no pip, I had to install it and copy its path to the system environment variables manually. Could it be connected the source of issue?

Can't install requirements using pip and python 3.8.5 on a Ubuntu 20.04 server

I'm trying to install python dependencies for a Django project, but I keep getting Non-user install because user site-packages disabled error. It sounds like a permission issue, I just can't figure out what went wrong. My working tools include:
Django
Python 3.8.5
Ubuntu 20.04
Probably worth mentioning, I am using a virtual environment for this project. Also, I have tried using root to install the packages without any luck. Any ideas on how to solve this issue is more than welcome.

Anaconda installation messed up the existing Python packages

For my project requirements I had installed Python packages like Jira and Bitbucket to connect to the servers using their API wrappers. After I installed Anaconda all the existing packages stopped working. Now Im getting No Module Found error for both Bitbucket and JIRA although the modules are already installed
For example :
pip3 install bitbucket-python
gives me that requirement is already satisfied. But when I run the code I get:
No module named "bitbucket" found
The same code was running fine 2 days ago before I installed anaconda.
Please help.
Now you have different versions of python and pip in your system. You have to make sure you are running correct version of the command. In my system with conda installed and activated pip3 refers to pip for system python. and pip for active conda python.
Try this: pip install bitbucket-python
you can use which command to see which binary is getting executed for example on my system.
dhananjay#ideapad:~$ which python
/home/dhananjay/.conda/bin/python
dhananjay#ideapad:~$ which pip
/home/dhananjay/.conda/bin/pip
dhananjay#ideapad:~$ which pip3
/usr/bin/pip3

Accidently did system-wide install of flask and sqlalchemy

I accidentally did a system-wide install of flask and sqlalchemy. I "sudo pip install"ed both of them, and now I'm wondering how i can uninstall both of those off my system. I already have virtualenv all set up, so I don't want flask or sqlalchemy attached to my system. I read that having it directly installed can cause problems when working with different frameworks and different versions of a framework.
Is it a problem that I did a system-wide install of these packages?
sudo pip uninstall flask should do the trick. And yes, having it installed globally can cause issues if you're working with different versions of other packages.

Problems getting Django up and running on OSX

First, I'm following the tutorial on the Django Poll application on their site and have hit a few road blocks.
I've installed Python 2.7 and Django 1.3
Created a new project with
django-admin.py startproject myproject
I got mysql up and running and entered the credentials in settings.py
Then when I try to run
python manage.py syncdb
it puked ... http://pastie.org/2294709
Then when I installed Mysql-python
easy_install mysql-python
Success! ...
Searching for MySQL-python
Best match: MySQL-python 1.2.3
Adding MySQL-python 1.2.3 to easy-install.pth file
Using /Library/Python/2.6/site-packages
Processing dependencies for MySQL-python
Finished processing dependencies for MySQL-python
so I try again
python manage.py syncdb
Still pukes the same message as above
Am I missing Something?
jondavidjohn's comment is spot on: you will have no end of confusion with multiple versions of Python on the Mac. There are some things you can do to deal with this.
Stick with 2.6
Convert to Lion, which has 2.7
Add an alias to your shell environment to invoke version 2.7 with $ python. In my bash_profile, I have "alias python='/usr/local/bin/python'"
Be sure to set your PYTHONPATH variable to the site packages directory that corresponds to the version of Python that you're using, such as PYTHONPATH=/usr/local/Cellar/python/2.7.1/lib/python2.7/site-packages
Make sure you know which version of easy_install is operative; many module problems arise from assuming that easy_install will use the same site-packages version for everything. Not true always. Every different Python bin directory has its own version of easy_install (or pip, by preference) which will use the corresponding site packages directory.
Don't try to run Django under Python 3.x
Don't try to get rid of the OS version of Python; it will break your installation because software update sometimes relies on it.
Once you're past this hurdle, there are some other parts of getting the sample poll app in Django to run that I had problems with, so I put my experience at https://github.com/technocrat/Writing-your-first-Django-app
You need to install and use a version of easy_install for your Python 2.7. You are using the version for the system Python 2.6. Follow the instructions here to install Distribute using python2.7 to launch python. Then use easy_install-2.7 to install mysql-python.

Categories