djangocms: command not found - python

I installed django cms by this command
$ sudo pip3 install django-cms
the installation is completed and returns this:
Requirement already satisfied: django-cms in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: django-classy-tags>=0.7.2 in /usr/local/lib/python3.6/dist-packages (from django-cms)
Requirement already satisfied: django-formtools>=1.0 in /usr/local/lib/python3.6/dist-packages (from django-cms)
Requirement already satisfied: Django<2.0,>=1.8 in /home/amir/.local/lib/python3.6/site-packages (from django-cms)
Requirement already satisfied: djangocms-admin-style>=1.0 in /usr/local/lib/python3.6/dist-packages (from django-cms)
Requirement already satisfied: django-sekizai>=0.7 in /usr/local/lib/python3.6/dist-packages (from django-cms)
Requirement already satisfied: django-treebeard>=4.0.1 in /usr/local/lib/python3.6/dist-packages (from django-cms)
However, when I want to use djangocms it returns
djangocms: command not found
I use Python 3.6 and django 1.9.5 (I know it is an old version but the project belongs to my company and they use this version).

http://docs.django-cms.org/en/release-3.4.x/introduction/install.html
My guess is you forgot to run: pip install djangocms-installer
I'm guessing that because I did that too. I installed pip install django-cms, then wondered why it didn't work.

Just ran into this and got it solved. Afterwards my palm went to my face because I was like "duh" lol. Oh well. Here is what the issue was for me and how I fixed it.
cd ~/
ls -al
This should give you the files and folders in your user directory. (NOTE: I use AWS instances so most of the time my user will be bitnami unless I change it. Your user will be different.) What you want to look for are .bashrc or .profile or both. I updated both. Use whatever text editor you wish to open that/those files
nano .bashrc
and/or
nano .profile
Usually at the top of these files you will have something like
PATH=/opt/bitnami/apache/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:
export PATH
The djangocms script is installed in the /home/bitnami/.local/bin folder. You will want to add this path to the PATH variable in your .bashrc and .profile files. (NOTE: If you don't use bitnami stacks your path will be slightly different. You can't just copy and paste from here) Now save these files.
Here is where my palm went to my forehead. I went back to my django projects directory and issued the command
djangocms -f -p . projectname
and received
djangocms: Command not found
I forgot that you have to reload this information into your session or log out and log back in for these changes to take effect. So either log out/reboot or if you don't want to log out you can issue the following command
source ~/.bashrc
After that everything should work fine. If not there were probably errors with your installation. Refer to the djangocms documentation regarding installation and python compatibility. Hope this helps someone.

Related

Python Docx Module Is Not Inside The Site-Packages Folder

I am new to python and I am trying to install the docx module, however it does not appear inside the site-packages folder.
First, I thought it was not showing up because my pycharm was outdated. Updated the base interpreter from 3.9 to 3.10 as well as pycharm. Deleted the venv folder and all that jazz. Opened the windows cmd and wrote pip install python--docx It shows that it is already installed:
Requirement already satisfied: python--docx in c:\users\me\appdata\local\programs\python\python310\lib\site-packages (0.8.11)
Requirement already satisfied: lxml>=2.3.2 in c:\users\me\appdata\local\programs\python\python310\lib\site-packages (from python--docx) (4.8.0)
But is nowhere to be found in the site-packages folder in either version of Python, what should I do?
My site-packages folder in Pycharm showed that they were disabled, colored orange, but it turns out that I just had to delete everthing inside the venv folder again and just check the box inherit global site-packages when changing the base interpreter. Everthing is fixed now!
Seems like python-docx doesn't work anymore. It throws a legacy error and appears to be out of date ver. 0.8.11. When you google - seems like there is a newer version https://pypi.org/project/docx/

ModuleNotFound Python

In my Macs Terminal I'm not able to use Python packages as I get a ModuleNotFound error. This is not the case in VS code, as I tried all kinds of things, including a venv based from a tutorial, and it seemed to work.
When I run pip install requests I get the following:
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
(2.25.1)
Requirement already satisfied: chardet<5,>=3.0.2 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
(from requests) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
(from requests) (1.26.5)
Requirement already satisfied: idna<3,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
(from requests) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
(from requests) (2020.12.5)
When I run python --version I get Python 3.9.5
I've spend hours now trying to get this "environment" up and correctly running, but with not much success.
The problem is that you have multiple Python versions installed. One possibly from the official Python website, and one through Homebrew (I'm guessing a bit). These interfere somewhat.
Here's the thing though: the "official" one didn't not install the standard python alias. It only installed the more explicit python3 command. Oddly (and confusingly) enough, it did install pip, probably alongside pip3.
When you type python, the shell will find the one installed by Homebrew; the other one doesn't not exist. When you explicitly type python3, you'll get the correct one. It looks like your PATH environment variable is set up to have the "official" installation come first, and then the Homebrew one.
So, best and easiest is to simply use python3 explicitly.
You could attempt to uninstall the Homebrew one in /usr/local/ if you want to and don't think you need it.
You could also tinker inside the /Library/Frameworks/Python.framework/Versions/3.9/bin and make an alias for python, but I wouldn't recommend it, unless you become more familiar with the shell, Python installations and your system. And after all, it's only one character more to type currently.

ModuleNotFoundError: No module named 'pandas' in vs code

When I'm trying to import pandas in vs code, I have the following error:
ModuleNotFoundError: No module named 'pandas'
I went to cmd and typed: pip3 install pandas and it got successfully installed showing following message:
Requirement already satisfied: pandas in c:\users\nitis\anaconda3\lib\site-packages (1.1.3)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\nitis\anaconda3\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\nitis\anaconda3\lib\site-packages (from pandas) (2020.1)
Requirement already satisfied: numpy>=1.15.4 in c:\users\nitis\anaconda3\lib\site-packages (from pandas) (1.19.2)
Requirement already satisfied: six>=1.5 in c:\users\nitis\anaconda3\lib\site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)
Please suggest what to do
There are a couple different ways that this can happen.
You are using a Python 2 Interpreter in VSCode
You are using a Python 3 installation which isn't Anaconda.
To solve this, I would recommend checking which python interpreter you are using using the following steps:
Go to View >> Command Palette >> Search for Python: Select Interpreter
Then check which interpreter you are using.
According to the information you provided, the reason is that the environment used in the lower left corner of VS Code is different from the terminal. You could use the following methods:
Method 1. Since the module "pandas" is installed in "Anaconda", please select the "conda" environment in the lower left corner of VS Code to ensure that the Python environment used is the same as that of the terminal.
Method 2. Use the shortcut key Ctrl+Shift+` to open a new VS Code terminal, it will automatically enter your currently selected Python environment (the lower left corner of VS Code). Then we can install the module "pandas" in the this environment.
check:
We can use the command "pip --version" to check the source of the module installation tool "pip", the module is installed in this location:
The command "pip show pandas" can check whether the module installation location is consistent with the Python environment displayed in the lower left corner of VS Code:
Reference: Python environment in VS Code.
Its because of PYTHONPATH issue . if you try to install pip install "module",it says that already satisfied but ,when you run the program the error occurs as modulenotFoundError In vscode, So I did uninstall the python interpreter ,and reinstall in specific path so that I can remember.
And go to environment variable ,path variable add new path ,where you installed python.exe and also add scripts and sitepackages. and also go to system variable ,path variable see if path is already added or not ,otherwise add it there too.
Restart the vscode It should work.
And I also run command in commandprompt as pip install "module".
It did work for me.

pip is only instaling to the default python instaltion how can i chnage it

i created a new project in pycharm. it created a new installation of python in a folder called myproject\vin.
pip will allways go to the default installation at
c:\\python64bit,
not c:\test\vin
example in my if i go import pandas it says that module does not exist.
if i go pip install pandas, it says
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
PS C:\Users\tpottel\programming\java\eclipse projects\BBitBotCoinUsing2\untitled1\venv\Scripts> pip install pandas
Requirement already satisfied: pandas in c:\python64bit\lib\site-packages (0.25.0)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\python64bit\lib\site-packages (from pandas) (2.8.0)
Requirement already satisfied: numpy>=1.13.3 in c:\python64bit\lib\site-packages (from pandas) (1.17.0)
Requirement already satisfied: pytz>=2017.2 in c:\python64bit\lib\site-packages (from pandas) (2019.2)
Requirement already satisfied: six>=1.5 in c:\python64bit\lib\site-packages (from python-dateutil>=2.6.1->pandas) (1.1
c:\python64bit is the default location
How can I change the installation pip will update? to
C:\Users\tpottel\programming\java\eclipse projects\BBitBotCoinUsing2\untitled1\venv\Scripts>
There are probably a few ways you might find more robust for managing multiple python installations on one machine such as creating a virtual environment (https://www.freecodecamp.org/news/installing-multiple-python-versions-on-windows-using-virtualenv/) but ignoring that, here's one way you could go about it.
There's two facts you'll need to know and work around for this, firstly, I think you'll need to make sure that you second python installation is added to path in order to call 'pip' from your terminal/command line.
Second is that python searches through installations in order, by finding the python.exe file. This means that with:
pip install pandas
which, it's worth nothing is shorthand for:
python -m pip install pandas
it will find the first python.exe based on a hierarchy and install to there, which is why you're not able to install to your second distribution.
If you rename the second distributions .exe to something like 'python64.exe' you can call it specifically with
python64 -m pip install pandas
hopefully that should help! Again, there might be a better way of acheiving this, but this is one method that should work.

Install pandas for Python 2.6

Currently I have two versions of python (2.6 and 2.7) on my unix machine.
Python 2.7 has already got pandas installed for it but 2.6 doesn't have.
So, I'm trying to install pandas specifically for python2.6 as my production environment has got ONLY python 2.6 and I cannot upgrade that at this point of time.
When I tried installing it using the below command, it says "Requirement already satisfied" pointing to python2.7 and nothing got added to python 2.6.
#user pip install pandas
Requirement already satisfied: pandas in /usr/local/lib/python2.7/site-
packages
Requirement already satisfied: pytz>=2011k in
/usr/local/lib/python2.7/site-packages (from pandas)
Requirement already satisfied: numpy>=1.7.0 in
/usr/local/lib/python2.7/site-packages (from pandas)
Requirement already satisfied: python-dateutil in
/usr/local/lib/python2.7/site-packages (from pandas)
Requirement already satisfied: six>=1.5 in
/usr/local/lib/python2.7/site-packages (from python-dateutil-
>pandas)
Please advice on how do I specifically install Pandas for Python2.6.
Assuming you installed Python 2.6 in the usual directory, you can just run
C:\Python26\Scripts\pip.exe
or go to that directory in a Command Prompt and run
.\pip.exe
Oops. Just noticed you're on a UNIX box. But the result is the same. You must specify the full path to the pip you want, or go to the directory and run .\pip
The other pip and python are in the system "path", the list of places that get searched for an executable. So, you have to tell the O/S exactly which pip you want to run. Otherwise, if you just say pip, it will find whichever one it can find in the system path.

Categories

Resources