Using Python 3.8 on Windows, having installed a number of other modules I have tried to install gastrodon with
(property) C:\Users\andyt>pip install gastrodon
The result is this:
Requirement already satisfied: gastrodon in c:\users\andyt\anaconda3\envs\property\lib\site-packages (0.9.3)
Requirement already satisfied: pandas in c:\users\andyt\anaconda3\envs\property\lib\site-packages (from gastrodon) (1.0.3)
Requirement already satisfied: IPython in c:\users\andyt\anaconda3\envs\property\lib\site-packages (from gastrodon) (7.13.0)
WARNING: No metadata found in c:\users\andyt\anaconda3\envs\property\lib\site-packages
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'c:\\users\\andyt\\anaconda3\\envs\\property\\lib\\site-packages\\ipython-7.13.0.dist-info\\METADATA'
Does anyone know how to fix this? I am able to install it in base...
Have you tried turning it on and off again? I mean potentially uninstall and reinstall it. I had a similar problem downloading numpy a while back and that seemed to fix it.
so I renamed metadata.json to metadata in a few similar positions where the install failed sequentially, and it appeared to have been successful, except I am now dealing with another error when trying to import gastrodon...
Related
I have been through the various Stack Overflow questions and non of the answers resolve the issue for me.
It is likely a path 'thing' that I am not seeing.
Have installed pandas, it says its there, but numpy will import and pandas won't.
Any ideas? What am I missing?
If I enter:
!pip3 install pandas
I get:
Requirement already satisfied: pandas in c:\users\ron mcmillan\appdata\local\programs\python\python38\lib\site-packages (1.0.3)
Requirement already satisfied: pytz>=2017.2 in c:\users\ron mcmillan\appdata\local\programs\python\python38\lib\site-packages (from pandas) (2020.1)
Requirement already satisfied: numpy>=1.13.3 in c:\users\ron mcmillan\appdata\local\programs\python\python38\lib\site-packages (from pandas) (1.18.4)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\ron mcmillan\appdata\local\programs\python\python38\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\ron mcmillan\appdata\local\programs\python\python38\lib\site-packages (from python-dateutil>=2.6.1->pandas) (1.14.0)
Okay, I'm going to give a completely new, opinionated, answer.
It looks like you've got at least two installations of Python, one in ..python\python38, and one in ..\python\python38-32. pandas is installed on the first, but jupyter is running on the second. You've got a version of pip for each, plus a third one in Microsoft\WindowsApps.
This happens.
On Windows, you are probably safe to just uninstall all the versions of Python on your computer. Then download Miniconda for Windows. Miniconda is, like pip, a package manager for Python; but unlike pip, is able to also install non-Python files, which makes all sorts of things much easier. It's called 'Miniconda' to distinguish it from 'Anaconda', which is conda plus almost all the packages a data scientist might need -- Miniconda just gives you the package manager conda, and you can then choose to install what you actually want.
Once conda is installed, create a new conda environment (conda create -n MYNEWENV -- if you have twenty minutes then read the quickstart explanation) and then try to download everything with conda install...
You can specify which 'channel' you download packages from, but you probably don't need to. Just try conda install jupyter numpy pandas; or search the Conda cloud for the specifics of whatever you want.
Make sure that the python installation which is running jupyter is the one that has pandas. Run where jupyter (which on linux/mac), and make sure it matches the paths above. Also try where pip to make sure the installations of pip, python, and jupyter match.
To be sure you're using a specific version of python+pip to install a package, you can call pip the module rather than the script, e.g. with c:\users\ron mcmillan\appdata\local\programs\python\python38\python -m pip install [pkg]
I'd consider using an environment manager such as virtualenv or conda to simplify environments & installation.
Try this:
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install pandas
There is a lengthy explanation here.
Going through the lengthy explanation above - will need to go through it again.
import sys
!{sys.executable} -m pip install numpy
returns:
'c:\users\ron' is not recognized as an internal or external command,
operable program or batch file.
import sys
sys.path
returns:
['C:\\Users\\Ron McMillan',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-
32\\python38.zip',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32\\DLLs',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32\\lib',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32',
'',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\win32',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\win32\\lib',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\Pythonwin',
'c:\\users\\ron mcmillan\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\Ron McMillan\\.ipython']
!type python
returns
The system cannot find the file specified.
And in the Command Prompt:
where jupyter
C:\users\ron mcmillan\appdata\local\programs\python\python38-32\Scripts\jupyter.exe
and
where pip
C:\users\ron mcmillan\appdata\local\programs\python\python38\Scripts\pip.exe
C:\users\ron mcmillan\appdata\local\programs\python\python38-32\Scripts\pip.exe
C:\users\ron mcmillan\appdata\local\Microsoft\WindowsApps\pip.exe
So, Jupyter note finding Python?
Ok, thank you.
Yes, I knew it was messy - to the point I din't get it. The picture makes sense.
You see that all is installed, but when I run runserver I got this error :
ModuleNotFoundError: No module named 'django_popup_view_field'
[p-amc-dgps-er#192-168-150-254 Invest_App]$ sudo pip install
django-popup-view-field [sudo] Mot de passe de p-amc-dgps-er :
DEPRECATION: Python 2.7 will reach the end of its life on January 1st,
2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python
2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: django-popup-view-field in
/usr/lib/python2.7/site-packages (0.5.0) Requirement already
satisfied: Django>=1.8 in /usr/lib/python2.7/site-packages (from
django-popup-view-field) (1.11.26) Requirement already satisfied: pytz
in /usr/lib/python2.7/site-packages (from
Django>=1.8->django-popup-view-field) (2018.9)
Maybe you should add this module to settings.py:
INSTALLED_APPS = [
...
'django_popup_view_field',
...
]
It won't let me comment because I don't have enough rep, but are you installing django-popup-view-field within a virtual environment? And are you also running runserver within that same virtual environment? it seems to be the most common issue when receiving the error "ModuleNotFound". Please look at this link it might help you.
If all else fails, sometimes it helps just to completely come out of that terminal and try again.
I am pretty new in Power BI and I try to set up the python script in it.
I have changed the option and activated the Python scripting. After that I get the error:
DataSource.Error: ADO.NET: Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib.pyplot
File "C:\Users\mm\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
Details:
DataSourceKind=Python
I check the conda list and it contains numpy.
I have installed numpy and pandas again and I got the message below
C:\Users\mm\AppData\Local\Continuum\anaconda3>py -m pip install numpy
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Requirement already satisfied: numpy in c:\users\mm\appdata\local\continuum\anaconda3\lib\site-packages (1.15.4)
C:\Users\mm\AppData\Local\Continuum\anaconda3>py -m pip install pandas
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Requirement already satisfied: pandas in c:\users\mm\appdata\local\continuum\anaconda3\lib\site-packages (0.23.4)
Requirement already satisfied: python-dateutil>=2.5.0 in c:\users\mm\appdata\local\continuum\anaconda3\lib\site-packages (from pandas) (2.7.5)
Requirement already satisfied: pytz>=2011k in c:\users\mm\appdata\local\continuum\anaconda3\lib\site-packages (from pandas) (2018.7)
Requirement already satisfied: numpy>=1.9.0 in c:\users\mm\appdata\local\continuum\anaconda3\lib\site-packages (from pandas) (1.15.4)
Requirement already satisfied: six>=1.5 in c:\users\mm\appdata\local\continuum\anaconda3\lib\site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
As you see I am using anaconda3 but there is another Python is installed on my macheine. I tried a lot of ways and nothing could help
Open the Anaconda Prompt:
Then, you have to go to the Conda Environment that you want to use in PowerBI. Am having an environment 'temp', so I activate it first in the 'Anaconda Prompt':
(base) C:\Users\ashish>conda activate temp
Then I go to the directory having the "PowerBI" executable file in the installation folder:
(temp) C:\Users\ashish>cd "C:\Program Files\Microsoft Power BI Desktop\bin"
Then, I launch PowerBI from the Prompt:
(temp) C:\Program Files\Microsoft Power BI Desktop\bin>PBIDesktop.exe
This fixes the NumPy error you are getting. If you want any other package to use with PowerBI, install that package in the respective "Conda Environment" (in my case it is "temp").
forget Anaconda and use WinPython.
I tried Anaconda for days with all the workarounds available in StackOverflow and other forums, and they took me nowhere.
Then I tried WinPython, and it worked immediately. Of course, you will need to change the PowerBI options accordingly.
To install WinPython: https://github.com/winpython/winpython
To change the detected Python home directory: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts#enable-python-scripting
If you consider my answer above others, you won't need to downgrade Python, PBI, or anything else.
I had similar issue trying to get Power BI to use Anaconda Python. After seeing a post about PBI having issues with Python 3.7 I:
Created a new environment in Anaconda using the Anaconda Navigator and made sure the new environment were using Python 3.6 (so NOT 3.7).
Installed in that environment the packages such as Pandas, Matplotlib and Seaborn that were used in my Power BI Python script
Went to Power BI's settings: File/Options and Settings/Options/Python scripting and set "Other" for Detected Python home dir and instead navigated to my new 3.6 python environment directory (visable in Anaconda Navigator at the bottom of the screen when selecting that environment)
..and that worked fine.
I think this error can be due to some numpy issues with Anaconda distribution.
I changed the Python path in Power BI to a virtual environment (which uses pip instead of conda to install numpy and other packages) and I had no more issues.
I am having trouble installing the sentiment_classifier.
What I have currently done:
pip install sentiment_classifier
python setup.py install
Downloaded sentiment_classifier-0.5.tar.gz
Placed the package into my directory
Error in shell:
pip install sentiment_classifier:
Requirement already satisfied: sentiment_classifier in c:\users\ac\anaconda3\lib\site-packages
Requirement already satisfied: numpy in c:\users\ac\anaconda3\lib\site-packages (from sentiment_classifier)
Requirement already satisfied: nltk in c:\users\ac\anaconda3\lib\site-packages (from sentiment_classifier)
Requirement already satisfied: argparse in c:\users\ac\anaconda3\lib\site-packages (from sentiment_classifie
)
python setup.py install - C:\Users\AC\Anaconda3\python.exe: can't open file 'setup.py': [Errno 2] No such file or directory
When I call it in Jupyter Notebook:
from senti_classifier import senti_classifier
I get:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\AC\Anaconda3\lib\site-packages\senti_classifier\data\SentiWn.p'
Any help would be greatly appreciated.
Docs I've been referring to:
https://pypi.python.org/pypi/sentiment_classifier
Sentiment Analysis using senti_classifier and NLTK
https://github.com/kevincobain2000/sentiment_classifier
http://pythonhosted.org/sentiment_classifier/
Any help would be greatly appreciated.
It is missing some files needed for it to work and no those files aren't downloaded when you install the package using pip, you can download the repository for the library from https://github.com/kevincobain2000/sentiment_classifier and then copy paste the files inside the '/src/senti_classifier/data/' into your library's directory which is 'C:\Users\AC\Anaconda3\lib\site-packages\senti_classifier\data' directory.
I'm trying to install a module called Scrapy. I installed it using
pip install Scrapy
I see the 'scrapy' folder in my /usr/local/lib/python2.7/site-packages, but when I try to import it in a Python program, is says there is no module by that name. Any ideas as to why this might be happening?
EDIT: Here is the output of the pip command:
Downloading/unpacking Scrapy
Downloading Scrapy-0.20.0.tar.gz (745kB): 745kB downloaded
Running setup.py egg_info for package Scrapy
no previously-included directories found matching 'docs/build'
Requirement already satisfied (use --upgrade to upgrade): Twisted>=10.0.0 in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): w3lib>=1.2 in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): queuelib in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): lxml in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /usr/local/lib/python2.7/site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): zope.interface>=3.6.0 in /usr/local/lib/python2.7/site-packages (from Twisted>=10.0.0->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/local/lib/python2.7/site-packages (from w3lib>=1.2->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg (from zope.interface>=3.6.0->Twisted>=10.0.0->Scrapy)
Installing collected packages: Scrapy
Running setup.py install for Scrapy
changing mode of build/scripts-2.7/scrapy from 644 to 755
no previously-included directories found matching 'docs/build'
changing mode of /usr/local/bin/scrapy to 755
Successfully installed Scrapy
Cleaning up...
When I run /usr/local/bin/scrapy I get the usage for the command and the available commands. I noticed that I have a python2.7 and python2.7-32 in my /usr/local/bin, and I remember installing the 32 bit version because of a problem with Mavericks.
Here is the output of python /usr/local/bin/scrapy:
Traceback (most recent call last): File "/usr/local/bin/scrapy", line 3, in <module> from scrapy.cmdline import execute ImportError: No module named scrapy.cmdline
And head /usr/local/bin/scrapy:
#!/usr/local/opt/python/bin/python2.7 from scrapy.cmdline import execute execute()
Are you using Homebrew or MacPorts or something? As #J.F.Sebastian said, it sounds like you are having issues mixing the default python that comes with OS X, and one that is installed via a package manager... Try /usr/local/opt/python/bin/python2.7 -m scrapy and see if that throws an ImportError.
If that works, then you may want to consider making that python executable your default. Something like alias python2.7=/usr/local/opt/python/bin/python2.7 and then always use python2.7 instead of the default python. You can likewise just point python to the /urs/local... bit, but then you won't have easy access to the system (OS X-supplied) python if you ever needed it for some reason.
EDIT: You can force pip to install to an alternate location. The details are here: Install a Python package into a different directory using pip?. If you do indeed have extra Python folders on your system, maybe you can try directing scrapy to those, even if just for a temporary solution.
Can you post the output of the pip command? Perhaps it is failing somewhere?
Also, is it possible you have two versions of Python on your machine? Pip only installs to one location, but perhaps the version of Python on your path is different.
Finally, sometimes package names given to pip are not exactly the same as the name used to import. Check the documentation of the package. I took a quick look and the import should be lowercase:
import scrapy
When all else fails you can always set the environment variable PYTHONPATH (see Permanently add a directory to PYTHONPATH for help) to the path where you installed Scrapy. (pending you're not using virtualenv -- and if you are please specify so we can help, it's generally a good idea to provide OS too)
if you run on Ubuntu:
use the official Ubuntu Packages, which already solve all dependencies for you and are continuously updated with the latest bug fixes.
Optionally, even if it solves your problem, it is always better to install python libraries on a virtual environment, using virtualenvwrapper to keep the libraries separated, try to examine the apt-get installation log to find out what tools where added, then remove scrapy python library and reinstall it in the virtual env. using pip
It appears that the scrapy module that is installed on the Python path is an executable file that will bootstrap a Scrapy project directory for you.
The Python code in the scrapy executable looks like this:
#!/usr/bin/env python
from scrapy.cmdline import execute
execute()
That's intended to be run from the command line rather than imported into your own Python project module.
According to the documentation for the project, running the scrapy executable with this syntax:
scrapy startproject <your-project-name>
will bootstrap a Scrapy project that has the following directory structure:
your-project-name/
scrapy.cfg
tutorial/
__init__.py
items.py
pipelines.py
settings.py
spiders/
__init__.py
...
There are a number of examples in the documentation that demonstrate how you create and run your own spiders, link extractors, etc., and how to manipulate the data that you retrieve with the application. They each demonstrate the appropriate Python imports from subdirectories in the scrapy package to get you up and running.
Hope that this helps.