How do I configure PyCharm to Pandas - pandas

I am using a mac OS Sierra 10.12.3
using Pycharm Community Edition 2016.3.2
in PyCharm i am using Python 2.7.11 and tried to run the following
import pandas as pd
it gives me error saying no modules named pandas
so i went to my terminal and typed
pip install pandas
here is the response
Brians-MBP:~ brians$ pip install pandas
Requirement already satisfied: pandas in ./miniconda3/lib/python3.5/site-packages/pandas-0.19.2-py3.5-macosx-10.6-x86_64.egg
Requirement already satisfied: python-dateutil>=2 in ./miniconda3/lib/python3.5/site-packages/python_dateutil-2.6.0-py3.5.egg (from pandas)
Requirement already satisfied: pytz>=2011k in ./miniconda3/lib/python3.5/site-packages/pytz-2016.10-py3.5.egg (from pandas)
Requirement already satisfied: numpy>=1.7.0 in ./miniconda3/lib/python3.5/site-packages/numpy-1.12.0-py3.5-macosx-10.6-x86_64.egg (from pandas)
Requirement already satisfied: six>=1.5 in ./miniconda3/lib/python3.5/site-packages/six-1.10.0-py3.5.egg (from python-dateutil>=2->pandas)
When I go to preferences - project interpreter and select 2.7.11 as my interpreter it does not show pandas.
but when i select 3.5.2 (~/miniconda3/bin/python) it does show pandas.
How do I link pandas to 2.7.11?

open PyCharm, go o preferences and then go to the Project Interpreter section. From there you can click the + button and then click on pandas and then click install packages

Mac OSX computers come with a version of Python 2.x pre-installed. The precise version depends on the recency of the computer, but all now ship with 2.7.11. Try opening a new command line and running which -a python in your command line: you should see something like /System/Library/Frameworks/Python.framework/Versions/2.7.
To install on this Python, you can open a new Terminal and simply run pip install pandas.
Note however that messing with your system Python is not recommended. It's strongly recommended that you use a virtualenv or conda (which you appear to be using) to virtualize the environment instead.
And while there is a way of achieving the same affect within PyCharm itself, this isn't a PyCharm-specific problem.

Related

Im having problems downloading packages to jupyter lab and vs code

Every time i try to download a package it says it isn't available
(GPU_BUY_BOT2) C:\Users\tyriq>pip3 install python-dotenv
Requirement already satisfied: python-dotenv in c:\users\tyriq\anaconda3\envs\gpu_buy_bot2\lib\site-packages (0.19.2)
Ive tried installing with conda as well when i go into jupyter lab it says the package doesn't exist.

Conda and Jupyter Notebook Environment Confusion

I am using Jupyter Notebook to help debug some issues I'm having moving between JSON and pandas. The specific application isn't important.
The important part is that I needed to use pandas.json_normalize() which apparently first showed up in pandas version 1.0.3. I was confused when Jupyter said it doesn't exist. I did a version check and got:
In[]: pd.__version
Out[]: 0.25.2
This is not the version of python installed in either my base environment or the conda environment that Jupyter Notebook is running in or that the app is running in. Version checks in both environments in Anaconda Prompt (outside of Jupyter Notebook) confirm this.
What is going on here? Looking around I haven't seen a good answer, but it does appear that other people have had the same issue --- Jupyter defaulting to pandas 0.25.2 for some reason.
It seems that your Notebook is using a different kernel/environment than what you want.
run this in the notebook to see which environment you are using
! which python
or try
import sys
print(sys.executable)
which would show you which environment it's using, if you have env named venv then you will get something like.
/home/your_home_directory/anaconda3/envs/venv/bin/python
If you don't care about all of that and you just want to update the pandas that it's using then copy that path and do this.
! pip install --upgrade pandas
Note that this will also depend on which version of python you are using

Unable to import required dependencies, Python with Pandas and Numpy

I think this question has been asked before on the internet, but the proposed solutions have so far not worked.
I am trying to run a script that imports numpy and pandas. When I run using the Python Console in my IDE (PyCharm), everything works fine. However, when I run the script from the command line, the following error is displayed:
DLL load failed: The specified module could not be found.
and
Unable to import required dependencies
I am using Anaconda Navigator. There my Pandas and Numpy are listed. I tried to uninstall them via the conda shell (conda uninstall numpy, conda uninstall pandas) and then install them again, but without result.
Hope anyone can help.
If you haven't already call this (no quotes)
conda activate "name of environment that has your modules installed"
After trial and error, I de-installed Anaconda and installed pip instead. Then I installed the modules using pip, and it worked like a charm.
(Not the most elegant answer since it does not explain why things went wrong in the first place, but it offered a workable solution at least.)

Using Anaconda Python 3.4 with PyQt5

I have an existing PyQt5/Python3.4 application that works great, and would now like to add "real-time" data graphing to it. Since matplotlib installation specifically looks for Python 3.2, and NumPhy / ipython each have there own Python version requirements, I thought I'd use a python distribution to avoid confusion.
But out of all the distros (pythonxy, winpython, canopy epd) Anaconda is the only one that supports Python 3.4, however it only has PyQt 4.10.4. Is there a way I can install Anaconda, and use matplotlib from within my existing PyQt5 gui app?
Would I be better off just using another charting package (pyqtgraph, pyqwt, guiqwt, chaco, etc) that might work out of the box with PyQt5/Python3.4?
I was able to install it from dsdale24's and asmeurer's channels but then, when trying to run a qt script with a QApplication object, I got an error message regarding to cocoa library not being found.
Then, following asmeurer's comment, I could install PyQt5 on anaconda with python 3.4 using the mmcauliffe package:
conda install -c https://conda.anaconda.org/mmcauliffe pyqt5
Now it works great!
We are working on adding pyqt5, but for now, you can install it from https://binstar.org/dsdale24/pyqt5.
conda config --add channels dsdale24
conda install pyqt5
create an env like this:
conda create –name my_env python=3.5 pyqt=5
works great.
I use Anaconda and with Python v2.7.X and qt5 doesn't work. The work-around I found was
Tools -> Preferences -> Python console -> External modules -> Library: PySlide

Trouble installing scipy on Mac OSX Lion

I've installed new instance of python-2.7.2 with brew. Installed numpy from pip, then from sources. I keep getting
numpy.distutils.npy_pkg_config.PkgNotFound: Could not find file(s) ['/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/lib/npy-pkg-config/npymath.ini']
when I try to install scipy, either from sources or by pip, and it drives me mad.
Scipy's binary installer tells me, that python 2.7 is required and that I don't have it (I have 2 versions installed).
EPD distribution saved the day.