I've recently downloaded the python package colorama to use in a small project, I'm having trouble installing/importing it.
For a bit more background, I use MacOS and I have two versions of Python on my Mac; 2.7 which comes with the mac by default and 3.7 which I use to code. The package seems to have been successfully installed, as when I try to reinstall it I get the message below. However, when I try to import the colorama module using a script in python 3.7 it simply tells me it doesn't exist.
Have I installed it for the wrong version of Python? And, if so, is it possible to make 3.7 my default version of python to prevent this from happening again? Or am I wrong about this issue entirely?
Requirement already satisfied: colorama in ./Library/Python/2.7/lib/python/site-packages (0.4.1)
Related
I'm using Python 3.7 and I recently upgraded to Spyder 4.2.0 from Spyder 4.1.5. Now when I run my code (which was working fine before) I get the following error:
ImportError: Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
So apparently Spyder thinks 'xlrd' ('Excel Reader'?) is not installed. So I went to the Anaconda prompt and tried pip install xlrd, but it replied with
Requirement already satisfied: xlrd in c:\users\michael\anaconda3\lib\site-packages (2.0.1)
I tried uninstalling and reinstalling xlrd anyways, using pip, but it didn't change anything. How do I resolve this error?
Also, I'm not sure if this matters or not, but I originally installed Spyder via Anaconda, whereas now I just downloaded Spyder 4.2.0 by itself, through this link: https://github.com/spyder-ide/spyder/releases.
Also, on the linked github page, it says: "If you are new to Python or the Scientific Python ecosystem, we strongly recommend you to install and use Anaconda. It comes with Spyder and all its dependencies, along with the most important Python scientific libraries (i.e. Numpy, Pandas, Matplotlib, IPython, etc) in a single, easy to use environment."
I had at first assumed this was meant for people downloading Python/Anaconda for the very first time, but now I'm thinking this applies to a semi newbie at Python such as me? As someone who is not very familiar with how packages and dependencies work, should I be downloading Anaconda every time I want to update Python or Spyder?
Apologies for the (probably) silly newbie question...
This sounds like you needed to re-start Spyder for it to pick up the package you installed.
However, as the author of xlrd, I would suggest you do the following:
Stop Spyder
conda install openpyxl
Start Spyder.
Change your pandas code to be pd.read_excel(..., engine='openpxyl')
I just upgraded the Python version from 3.8.4 to 3.8.5
And I faced a very major problem.
All modules that I already installed aren't available with the following error message:
ModuleNotFoundError: No module named 'module name'
So I tried to re-install the module with:
pip3 install module_name
And it returns an message:
Requirement already satisfied: module_name in /usr/local/lib/python3.8/site-packages (2.8.5)
OS : Mac os
And I somehow figured it out that python libraries are saved on usr/lib/~
and there are two versions, one python 3.7.3 and python 3.8.5
And when I typed
python3 --version it printed out
Python 3.7.3
However, when I tried to install throgh pip3 it checked the module on python 3.8.5 which I want to use.
Therefore I think I need to change my default python3 version from python 3.7.3 to python 3.8.5.
How to change the default python version to python 3.8.5?
What's the problem here and how to fix it?
I had the same problem once but with another version of python. The problem was about the module path: while pip install was using the correct path, my programs were using a different one, hence the error.
Try adding this to your program, where the path must be the absolute path to the folder containing the modules
sys.path.append('/path/to/search')
If it works you can fix it permanently by adding an environment variable with the path to the modules (the way to do it changes depending on the system)
I recently installed Anaconda spyder 2020 version, resulting in Python 3.7.6 being installed.
I previously had ffn installed and working.
Now when I run code that tries to import ffn, it comes up with Module not found - No module named 'ffn'.
However, when I issue pip freeze at the console, I can see ffn == 0.3.3
Can anybody shed any light on why I have having problems importing ffn?
If you install anaconda it will automatically install its own version of python with a specific directory for site-packages so either you need to find and use your old python binary or install ffn again this time with the newly installed anaconda since just syncing the two site-packages directories won't work because minor releases of python (e.g 3.7 and 3.5 ) aren't necessarily compatible.
I have already installed the anaconda module and it already has built-in pandas package that I want to make use of. I have python 3.6 installed in my machine. Environment variables for anaconda and python are set as well but I am still unable to import pandas on my python console.
Could anyone help me import the pandas? I can not make use of pip tool as I am working on my company's machine. Due to security issues, I am not allowed to download any package through pip. I want to make use of pre-installed anaconda module. Help me link my python to Anaconda.
Trying to import python module fake_useragent
Command prompt stating that it has already been installed.
Anybody knows how come I still cannot import the fake_useragent module in python even though I have already installed it?
Thank you very much, I have solved the problem. I have tried to uninstall and reinstall the module but it still did not work. I tried to use Jupyter Notebook as well as Pycharm to import the module but I could not. Eventually, I tried to import the module using IDLE, which is the default IDE which comes with downloading and installing Python from python.org and I was successful. Therefore, I suspected that I had accidentally installed two versions of Python on my computer. The problem is that I have already installed Python 3 inside my computer. However, on top of that, I have also installed the Anaconda package, which also installs its own version of Python 3. However, when I use pip to install the fake-useragent module, I am installing it for the original python version. Therefore, when I use Jupyter notebook which is part of the Anaconda package, I could not input the module. I could not import it for Pycharm as well since I used the Anaconda interpreter as Pycharm's default interpreter. After I have uninstalled Anaconda and changed the default interpreter for Pycharm under settings back to the original version of Python which I have installed, I'm able to import the fake-useragent in python.