Accessing Pattern library in Spyder - python

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?

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)

Python Imports - Many Modules not Recognized

I am trying to follow a tutorial book called "Data visualization with Python and Javascript" and am running into many issues importing modules used in the book. I have made sure to do "pip install" on as many of the packages used as possible, and have successfully done it for packages such as SQLAlchemy and matplotlib.
However, when I import modules from SQLAlchemy and even dateutil that are used in the tutorial, I receive an import error, "ImportError: No module named {module}"
On the following lines of code:
from dateutil import parser
from SQLAlchemy import create_engine
This has occurred often enough with different modules that I am beginning to get concerned I can no longer actually follow the tutorial. I had to skip a whole section of how to use SQLAlchemy.
Furthermore, SQLAlchemy is properly installed:
Requirement already up-to-date: sqlalchemy in c:\users\{user}\appdata\local\continuum\miniconda3\lib\site-packages (1.2.15)
What obvious thing am I missing here that needs to happen for me to use these packages and modules?
EDIT:
python --version
Python 3.7.1
pip --version
pip 18.1 from C:\Users\{user}\AppData\Local\Continuum\miniconda3\lib\site-packages\pip (python 3.7)
However, I am using Anaconda for a virtual environment, and PyCharm as my IDE. I have included a screenshot of the projects interpreter for a good measure.Project Interpreter
Furthermore, I have checked that I have pip installed it on both the root and the environment.Root Environment
I think, you have multiple python versions installed.(2.* | 3.*)
You are installing packages in one python version and using another python version.
EDIT:
You can use pip2 install modulename for python2
and pip3 install modulename for python3

I installed matplotlib successfully but when I try to import it it gives an error with 'no module named matplotlib'

I installed python 3.7 on my pc (win 10). Later I tried to install matplotlib using a pip command, it installed and matplotlib is now also inside the pip list. When I go to the lib/site-packages folder where I saved python, it clearly has matplotlib inside of it. matplolib also works when us it in my command promt after using the 'python' command. But when I wanna import it in my project in pycharm, it does not work and no module is found.
I am new to all this and this is the first module I installed for python, so I can not figure out what I am doing wrong here. The version of matplotlib I am trying to install is 2.2.3.
Thx for any help

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.

Conda openpxyl install results in No module named 'openpyxl'

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.

Categories