No module named 'pandastable' - pandas

I'm trying to change table wrote by me on tkinter with the pandastable one in order to do the handling of data directly from a pandas.DataFrame.
But despite I have already installed Anaconda3 with matlplotlib, numpy, pandas ect. modules when i would like to import pandastable I have trouble.
This is the problem:
import pandastable
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import pandastable
ImportError: No module named 'pandastable'

pip install pandastable
Requires python>=3.3 or 2.7 and numpy, matplotlib and pandas.
See: pandastable on github
edit: You may have multiple Python environments installed on your machine. Anaconda uses conda install to keep things in check but pandastable doesn't seem to be available through Anaconda packages. Make sure you are installing to the same Python environment that your script uses. You might also try:
pip3 install pandastable

Related

Pip install does not work, matplotlib seems to be broken, pyenv and fresh new install doesn't work

So I wanted to import matplotlib to my virtual python version of 3.10.0 (and other versions). I install it as usual:
pip install matplotlib
Everything seems to work, no errors show up with pip. But when I try to run this code snippet in vs code (to see if mpl works):
import matplotlib
print(matplotlib.__version__)
It outputs this:
File "/Users/XYZ/Desktop//pienv.py", line 1, in <module>
import matplotlib
File "/Users/XYZ/Desktop//matplotlib.py", line 1, in <module>
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib.pyplot'; 'matplotlib' is not a package
But when I do the same in the terminal it outputs the correct version.
It doesn't matter if I have python installed with dmg file or with pyenv, result is the same.
I tried to format operating system to ensure there is no os trash that might be getting in a way. Then I just installed python with pyenv.
I'm using osx 12.0.1
My vscode setup is straightforward, just python extension and python interpreter set to what pyenv has as a local python.
Is there that can be done, or that I'm doing wrong?
Found the answer.
It's just a stupid thing.
Don't name your projects with the names of your libraries when they're in the same directory.

ImportError Pandas in Jupiter notebook - Not looking at venv packages

I installed pandas via pip in my virtualenv venv.
When I run import pandas as pd, I get the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-588656c123e4> in <module>
3 import tarfile #2
4 from six.moves import urllib #3
----> 5 import pandas as pd #4
ModuleNotFoundError: No module named 'pandas'
I am running Jupiter notebook in the virtual environment. To make sure it installed properly, I opened the python in the virtualenv and ran the import, and it worked fine, what could be the issue? Could it be that though I ran Jupiter Notebook in my venv its not looking at the packages in the virtual environment?
Edit 1: I installed pandas on my machine, not in the virtual machine, and that resolved my issue. However, I want the notebook to look at the packages in my virtual environment, how do I do that?
Try running this in a Jupyter cell
!pip install pandas

I want to use pandas2ri in JUPYTER but tzlocal issue?

Everytime I try to import the pandas2ri in jupyter, python interface:
from rpy2.robjects import pandas2ri
I get the following error:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-28-cc52694d111a> in <module>()
----> 1 from rpy2.robjects import pandas2ri
/Users/sondosayyash/anaconda/lib/python3.6/site-packages/rpy2/robjects/pandas2ri.py in <module>()
21 import numpy
22 import pytz
---> 23 import tzlocal
24 import warnings
25
ModuleNotFoundError: No module named 'tzlocal'
I tried to use
from dateutil.tz import tzlocal
but that didn't seem to fix the issue.
I've already installed tzlocal and it is on my computer. When I import pandas2ri on ipython, there is no problem.. the problem only occurs when calling in the jupyter environment.
this is the message I get when I try to install tzlocal again:
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.
Requirement already satisfied: tzlocal in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (1.5.1)
Requirement already satisfied: pytz in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tzlocal) (2017.2)
I had a similar issue when running rpy2 in Jupyter. I did not have the package installed previously. I just installed the package and the error went away. You can try installing the package again to see if it helps resolve your issue.
pip install tzlocal
I must add that I am using Python 3.6.8 not 2.7
If using conda:
conda install tzlocal
worked.
I had a similar issue as yours. It turns out that my local lib did not have the tzlocal package. So I installed the package through Anaconda prompt:
pip install tzlocal
And the issue is gone.

How can I install mpmath as an external library for Blender?

I'm interested in trying out sympy with Blender (v2.76, Python 3.4.2 Console, Windows 8.1). I followed this answer from Blender SE, downloaded sympy as a ZIP from Githib, and moved the sympy folder to C:\Program Files\Blender Foundation\Blender\2.76\python\lib\site-packages. However, when I opened Blender and tried to import sympy in the Python Console, I got the following error:
>>> import sympy
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "C:\Program Files\Blender Foundation\Blender\2.76\python\lib\site-packages\sympy\__init__.py", line 20, in <module>
raise ImportError("SymPy now depends on mpmath as an external library. "
ImportError: SymPy now depends on mpmath as an external library. See http://docs.sympy.org/latest/install.html#mpmath for more information.
I don't know how to install an external library. I tried going to the link mentioned in the ImportError, and I saw pip install mpmath. I tried it in cmd, but got this:
>pip install mpmath
Requirement already satisfied (use --upgrade to upgrade): mpmath in c:\anaconda3
\lib\site-packages
I did install Anaconda a while ago, so I guess it makes sense to have this output. How can I install mpmath as an external library for Blender so I can import sympy in it?
You want to install mpmath into blenders python folder, the same as you have done for sympy.
Your example of running pip was done in a system installed python that is setup to find the mpmath that you have installed in c:\anaconda3\lib\site-packages
Another option is to use the existing install of mpmath and sympy by adding your existing path to sys.path or adding it to the PYTHONPATH environment variable before you start blender.

Python can't import requests, numpy

I downloaded a Python 3.5 application which needs to import requests, overpy, numpy and tk. So, when I try to import, say, requests, I get:
Traceback (most recent call last): File "", line 1, in
ImportError: No module named 'requests'
I have searched the internet for answers and the best I could find is in this link getting error for importing numpy at Python 3.5.1 . I do have other versions installed, 2.7 is installed by default, however knowing where the problem is doesn't offer a solution.
If it is relevant to configuration issues, I have a Mac with El Capitan.
Do you have pip installed? It's likely that you don't have the package readily available. You will need to download pip for your operating system (if you haven't already), then run
pip install requests
http://docs.python-requests.org/en/master/user/install/
If you have pip installed and think you have requests installed as well, then run
pip freeze
It's most likely not an issue with your python versions, though you will want to be sure when you install pip that it is installed in the correct location.