Conda openpxyl install results in No module named 'openpyxl' - python

I installed several conda environments with different Python versions.
After activating my Python 3.5 environment I have installed openpxyl via the line given here: https://anaconda.org/anaconda/openpyxl
However, when I try to import I get
ImportError: No module named 'openpxyl'
When I type conda list I do see
openpyxl 2.4.7 py35_0 anaconda
in the list.
(code to import is just import openpyxl or from openpyxl import *)
Any suggestions? Thanks!

You can try deleting all openpyxl material then reinstall it using pip.
that's how i solved my problem at least.

Even I faced the Same issue. This might Help you. If we have given python path in the windows environment variables which is present before we installed anaconda. We can test it by using
python --version
It will give you the version if the path is already present as
Python 3.6.5
Please remove this path of python which is already mentioned.
Then give the path of the python which is is anaconda directory. Normally it will in the path
C:\Users\lenovo\Anaconda3\
Just add this path to environment variables and again check for the python version
that might give you the following result
Python 3.6.5 :: Anaconda, Inc.
then it is confirmed that you are using the python which is downloaded using anaconda package manager.
Now you use the conda modules anywhere.

Related

Issue with Anaconda package manager - library installed, but not found in Spyder

I installed cairo using Anaconda Navigator (in case it's important, cairo is also installed in the other two environments: miniconda3 and spyder-env):
I launch Spyder from Anaconda Navigator, and try to import cairo, and get an error saying:
ModuleNotFoundError: No module named 'cairo'
Spyder seems to be using the correct python environment. If I run `conda list cairo', I get the following output:
What am I doing wrong?
I had problem similar to this with VaderSentiment analysis library. Jupyter notebook couldn't find it although it was installed. Either you can use a more stable Python version such as Python 3.7 for compatibility or you can use importlib.
conda install python=3.7
I solved it using importlib This does not answer your question "what am i doing wrong", but it solved the problem in my case. Just locate cairo.py in your Anaconda folder whatever the environment is. You can make necessary adjustments. I hope this helps if you have emergency to use that package.
import importlib.util
import sys
spec = importlib.util.spec_from_file_location("vaderSentiment", r"C:\Users\matt\Anaconda3\envs\sentiment\Lib\site-packages\vaderSentiment\vaderSentiment.py")
foo = importlib.util.module_from_spec(spec)
sys.modules["vaderSentiment"] = foo
spec.loader.exec_module(foo)

Cannot open pyarrow in Spyder, but can open in windows cmd

I am trying to read a Bigquery query and store into a data frame. I have tried both google.cloud and pandas-gbq packages require pyarrow.
I have installed pyarrow, which I can test through pip show pyarrow:
I can also test through importlib, from which I receive the following answer:
The location shown above is contained on PYTHONPATH from Spyder:
And I can also import pyarrow when running Python from Windows cmd.
But when I try to import it from Spyder I receive the following error:
ModuleNotFoundError: No module named 'pyarrow.lib'
Thanks in advance for those who came this far :)
Solved:
Apparently, Spyder was running default python interpreter version (3.7), while the pyarrow package was only installed for a more updated version, which was already installed (3.9).
I changed the interpreter on which Spyder was running and it worked:

Accessing Pattern library in Spyder

My base environment in Python 3.7. I created a new environment called Python27 (which is Python 2.7 version as I want it for Text Analytics) and is my current environment. I activated it using the command activate Python27. So, the top left corner in spyder shows as Spyder(Python 2.7)
I installed Pattern Library using pip install pattern and it got successfully installed after I resolved the C1083 error. Now I am having issues accessing it in Spyder when I type from pattern.en import suggest I get the error
ImportError: No module named pattern.en
The same issue is with spacy library. Moreover, I cant see the libraries Pattern and Spacy in conda list.
where am I going wrong?

Failed to import WordCloud from wordcloud

I installed wordcloud package for my 64 bit windows 10 system with anaconda python 3.5
using python -m pip install D:\folder\wordcloud-1.5.0-cp35-cp35m-win_amd64.whl
command.
It has been successfully installed.
But when I am trying to import from wordcloud import WordCloud,STOPWORDS, I am getting error.Please check this:
Has it something to do with the path of wordcloud-1.5.0-cp35-cp35m-win_amd64.whl file as I have placed it in some random folder?
Thank you in advance.
The simplest way to trace the error is to import the package (which apparently works) with import wordcloud and then list all members of the package with help(wordcloud). Check if the version and functions match your expectations. Check if it also matches the documentation of your package.
I suspect that the name of the WordCloudclass was simply changed.
If you miss functions then your package is broken. If the version number is wrong then you downloaded an old package. Use the Anaconda Navigator that usually comes with Anaconda to reinstall the package. If you do not have the Navigator use whatever package manager you have.

Downloaded Pandas, but getting error when importing into Pycharm

I downloaded the pandas package to my computer using the pip install. When I try to import pandas as pd into Pycharm I get the following error message:
ModuleNotFoundError: No module named 'pandas'
I know I have downloaded the package, but how do I get Pycharm to recognize that I have downloaded the package?
You almost certainly don't have your interpreter set correctly.
Go to preferences -> project -> project interpreter and make sure that the version of Python matches the environment where you did you pip install or conda install.
Also, if you aren't sure which Python you're using you can always run which python.

Categories