Error importing pandas through the bash envrionment - bash

I've attempted to resolve this with answers to similar issues in the forum but was unsuccessful. Any help would be much appreciated as I've been stuck for a while.
I have downloaded Python through the Anaconda distribution.
When I attempt to import pandas by running a script (forum.py) in GITBASH I get the following error:
$ python forum.py
Traceback (most recent call last): File "forum.py", line 1, in
import pandas as pd File "C:\Users\jimen\Anaconda3\lib\site-packages\pandas__init__.py", line
42, in
from pandas.core.api import * File "C:\Users\jimen\Anaconda3\lib\site-packages\pandas\core\api.py", line
10, in
from pandas.core.groupby import Grouper File "C:\Users\jimen\Anaconda3\lib\site-packages\pandas\core\groupby.py",
line 50, in
from pandas.core.frame import DataFrame File "C:\Users\jimen\Anaconda3\lib\site-packages\pandas\core\frame.py",
line 77, in
from pandas.core.series import Series File "C:\Users\jimen\Anaconda3\lib\site-packages\pandas\core\series.py",
line 81, in
import pandas.plotting._core as gfx File "C:\Users\jimen\Anaconda3\lib\site-packages\pandas\plotting__init__.py",
line 15, in
from pandas.plotting._converter import \ File "C:\Users\jimen\Anaconda3\lib\site-packages\pandas\plotting_converter.py",
line 8, in
import matplotlib.units as units File "C:\Users\jimen\Anaconda3\lib\site-packages\matplotlib__init__.py",
line 1111, in
rcParamsOrig = RcParams(rcParams.copy()) File "C:\Users\jimen\Anaconda3\lib\site-packages\matplotlib__init__.py",
line 891, in getitem
from matplotlib import pyplot as plt File "C:\Users\jimen\Anaconda3\lib\site-packages\matplotlib\pyplot.py",
line 32, in
import matplotlib.colorbar File "C:\Users\jimen\Anaconda3\lib\site-packages\matplotlib\colorbar.py",
line 28, in
import matplotlib.artist as martist AttributeError: module 'matplotlib' has no attribute 'artist'
I'm not sure what to do and how to resolve this so any help would be much appreciated.
Thanks !

Related

ImportError: libc10_cuda.so: cannot open shared object file: No such file or directory

I'm now trying to train my own model in a conda environment, using ABCNet with Ubuntu 16.04, CUDA 10.2. Got a complaint: "libc10_cuda.so: cannot open shared object file: No such file or directory". I reinstalled CUDA-10.2 but the problem still remains. For more details, please see the transcripts below.
OMP_NUM_THREADS=1 python tools/train_net.py --config-file configs/BAText/Pretrain/attn_R_50.yaml OUTPUT_DIR text_pretraining/attn_R_50
Traceback (most recent call last): File "tools/train_net.py", line 40, in from adet.data.dataset_mapper import DatasetMapperWithBasis File "/home/zzr/AdelaiDet/adet/init.py",
line 1, in from adet import modeling File "/home/zzr/AdelaiDet/adet/modeling/init.py",
line 2, in from .fcos import FCOS File "/home/zzr/AdelaiDet/adet/modeling/fcos/init.py",
line 1, in from .fcos import FCOS File "/home/zzr/AdelaiDet/adet/modeling/fcos/fcos.py",
line 10, in from adet.layers import DFConv2d, NaiveGroupNorm File "/home/zzr/AdelaiDet/adet/layers/init.py",
line 5, in from .bezier_align import BezierAlign File "/home/zzr/AdelaiDet/adet/layers/bezier_align.py",
line 7, in from adet import _C
ImportError: libc10_cuda.so: cannot open shared object file: No such file or directory

Error starting the Jupyter notebook on Windows

When I write jupyter notebookon my on command prompt, I get an error on cmd while running jupyter. I don't understand why this is happening again and again. Therefore, it blocks to open jupyter editor in the browser. I have added all environment variables as usual, but it's not working yet. Could you please help to solve this? Any kinds of suggestions are welcome.
H:\Research\NLP\NLP Task 1>jupyter notebook
Traceback (most recent call last):
File "C:\Users\Imran\Anaconda3\lib\site-packages\notebook\nbextensions.py", line 18, in <module>
from urllib.request import urlretrieve
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\urllib\request.py", line 88, in <module>
import http.client
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\http\client.py", line 71, in <module>
import email.parser
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\feedparser.py", line 27, in <module>
from email._policybase import compat32
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\_policybase.py", line 9, in <module>
from email.utils import _has_surrogates
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\email\utils.py", line 29, in <module>
import socket
File "C:\Users\Imran\AppData\Local\Programs\Python\Python36-32\Lib\socket.py", line 49, in <module>
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Imran\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\Imran\Anaconda3\lib\site-packages\notebook\__init__.py", line 25, in <module>
from .nbextensions import install_nbextension
File "C:\Users\Imran\Anaconda3\lib\site-packages\notebook\nbextensions.py", line 20, in <module>
from urlparse import urlparse
ModuleNotFoundError: No module named 'urlparse'
I uninstall python and anaconda. Then i reinstall it again. And it works again.

Importing pandas in windows

I tried multiple methods with Anaconda and python both using version 3.6 and when I import pandas I'm getting the following error in my Windows machine
import pandas
File "D:\python3\lib\site-packages\pandas\__init__.py", line 22, in <module>
from pandas.compat.numpy import *
File "D:\python3\lib\site-packages\pandas\compat\__init__.py", line 59, in <module>
import http.client as httplib
File "D:\python3\lib\http\client.py", line 71, in <module>
import email.parser
File "D:\email.py", line 5, in <module>
import pandas.io.sql as psql
File "D:\python3\lib\site-packages\pandas\io\sql.py", line 14, in <module>
import pandas.lib as lib
File "pandas\lib.pyx", line 1, in init pandas.lib (pandas\lib.c:90879)
File "pandas\tslib.pyx", line 59, in init pandas.tslib (pandas\tslib.c:115313)
ImportError: cannot import name is_platform_windows
It seems to be environment related but I can't find anything related to this issue when I google this.
Looks like it was picking anything python script in my folder called email.py and that's causing the issue.

iolib import error in python

On Mac OS X Mountain Lion, I try
import numpy as np
import os
import statsmodels.api as sm
I get this error:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /Users/idf/PycharmProjects/PyAlgoTrade/GoldvsMiners.py
Traceback (most recent call last):
File "/Users/idf/PycharmProjects/PyAlgoTrade/GoldvsMiners.py", line 9, in <module>
import statsmodels.api as sm
File "/Library/Python/2.7/site-packages/statsmodels-0.0.0-py2.7-macosx-10.8-intel.egg/statsmodels/api.py", line 1, in <module>
import iolib, datasets, tools
ImportError: No module named iolib
If I add
import sys
print("=======")
print sys.path
print("=======")
I get
=======
['/Users/idf/PycharmProjects/PyAlgoTrade', '/Library/Python/2.7/site-packages/pytz-2013b-py2.7.egg', '/Library/Python/2.7/site-packages/statsmodels-0.0.0-py2.7-macosx-10.8-intel.egg', '/Library/Python/2.7/site-packages/pip-1.4-py2.7.egg', '/Users/idf/PycharmProjects/PyAlgoTrade', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages']
=======
I have tried searching the net, but I am stuck on this one. Any ideas?

running package throws ImportError: No module named image

Using cx_freeze under ubuntu 12.04. The generation of the package is
done without any errors but when I try to run the package as a
standalone, I get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/initscripts /Console.py",
line 27, in <module>
exec code in m.__dict__
m m File "Setup_cx_freeze.py", line 3, in <module>
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/__init__.py",
line 4, in <module>
from cx_Freeze.dist import *
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/dist.py",
line 3, in <module>
import distutils.command.install
File "/usr/lib/python2.7/distutils/command/install.py", line 21, in <module>
from site import USER_BASE
File "/usr/lib/python2.7/site.py", line 562, in <module>
main()
File "/usr/lib/python2.7/site.py", line 540, in main
abs__file__()
File "/usr/lib/python2.7/site.py", line 100, in abs__file__
m.__file__ = os.path.abspath(m.__file__)
File "/usr/lib/python2.7/email/__init__.py", line 79, in __getattr__
__import__(self.__name__)
ImportError: No module named image
I think what to focus on is the last sentence. "ImportError: No module named image."
The application runs without any problems in pure python environment
So why do I get the Error when running it as a "freeze" package? The
fault is somehow introduced when generating the freeze-package.
I ended up fixing this by explicitly including the package "email.mime" in the setup.py script build exe options.
Missing 'image' is just first part of the problem. Try to add this to your code:
from email.mime.image import MIMEImage
from email.mime.audio import MIMEAudio
from email.mime.message import MIMEMessage
This resolved problems with 'image', 'audio' and 'message'.
Resolved this by installing Python Imaging Library: http://www.pythonware.com/products/pil/
1) python setup.py build
2) sudo python setup.py install

Resources