Python3.7.4 - Error while importing pandas libraries - python

I had installed Python manually by using below comamnd-
#cd Python-3.7.4
#./configure --enable-optimizations
#make altinstall
and later NumPy and Pandas libraries manually as below -
#python3.7 setup.py install
ERROR -
>>> import pandas as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/mycom/data/support/pandas-1.0.3/pandas/__init__.py", line 55, in <module>
from pandas.core.api import (
File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/api.py", line 29, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/groupby/__init__.py", line 1, in <module>
from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/groupby/generic.py", line 60, in <module>
from pandas.core.frame import DataFrame
File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/frame.py", line 104, in <module>
from pandas.core.generic import NDFrame, _shared_docs
File "/opt/mycom/data/support/pandas-1.0.3/pandas/core/generic.py", line 99, in <module>
from pandas.io.formats import format as fmt
File "/opt/mycom/data/support/pandas-1.0.3/pandas/io/formats/format.py", line 75, in <module>
from pandas.io.common import stringify_path
File "/opt/mycom/data/support/pandas-1.0.3/pandas/io/common.py", line 3, in <module>
import bz2
File "/usr/local/lib/python3.7/bz2.py", line 19, in <module>
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
Then I tried workaround around as mentioned below but it didn't help
missing python bz2 module
Below are OS details-
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Linux NVMBD1CJH190V03 3.10.0-514.el7.x86_64 #1 SMP Wed Oct 19 11:24:13 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Related

ImportError: when I use quandl module in python

ImportError: when I use quandl module in python
Traceback (most recent call last):
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\workspace\python\stock-lab\agent\quandl.py", line 1, in <module>
import quandl
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\quandl\__init__.py", line 7, in <module>
from .model.database import Database
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\quandl\model\database.py", line 5, in <module>
import quandl.model.dataset
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\quandl\model\dataset.py", line 5, in <module>
from .data import Data
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\quandl\model\data.py", line 1, in <module>
from quandl.operations.data_list import DataListOperation
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\quandl\operations\data_list.py", line 1, in <module>
from quandl.model.data_list import DataList
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\quandl\model\data_list.py", line 2, in <module>
from .data_mixin import DataMixin
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\quandl\model\data_mixin.py", line 1, in <module>
import pandas as pd
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\__init__.py", line 55, in <module>
from pandas.core.api import (
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\api.py", line 29, in <module>
from pandas.core.groupby import Grouper, NamedAgg
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\groupby\__init__.py", line 1, in <module>
from pandas.core.groupby.generic import DataFrameGroupBy, NamedAgg, SeriesGroupBy
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\groupby\generic.py", line 60, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\frame.py", line 124, in <module>
from pandas.core.series import Series
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\series.py", line 4572, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\generic.py", line 10349, in _add_series_or_dataframe_operations
from pandas.core.window import EWM, Expanding, Rolling, Window
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\window\__init__.py", line 1, in <module>
from pandas.core.window.ewm import EWM # noqa:F401
File "C:\Users\vopl1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pandas\core\window\ewm.py", line 5, in <module>
import pandas._libs.window.aggregations as window_aggregations
ImportError: DLL load failed: 지정된 모듈을 찾을 수 없습니다.
I did several things, but I don't know why the module was not available
I installed quandl
as followed :
pip install quandl
I made my under python code
import quandl
quandl.ApiConfig.api_key = '##############'
data = quandl.get('BCHARTS/BITFLYERUSD', start_date='2019-03-07', end_date='2020-05-02')
print(data)
I call my pthon code
python -m myPythonCode
and then, I saw the error.
So I deleted and installed, but failed.
So I installed as followed :
pip3 install quandl
this is still failed.
if uninstall quandl and then call my python code, I can see error :
ModuleNotFoundError: No module named 'quandl'
Plz, Help me.
When the error is DLL related, many times it can be resolved by installing the Microsoft Visual C++ Redistributable that is most likely missing.
Microsoft Visual C++

Skilearn ImportError: DLL load failed: The specified module could not be found

I am attempting to verify version of my Sklearn to verify the proper installation, earlier I was having an issue where I had to change my registry value of Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem#LongPathEnabled value to 1.
Then I was able to install the files how ever, now when I attempt to check the version of my skilearn I get the following:
Traceback (most recent call last):
File "C:/Users/terry/pyversions.py", line 11, in <module>
import sklearn
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\__init__.py", line 74, in <module>
from .base import clone
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\base.py", line 20, in <module>
from .utils import _IS_32BIT
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\utils\__init__.py", line 25, in <module>
from .fixes import np_version
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\sklearn\utils\fixes.py", line 18, in <module>
import scipy.stats
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\__init__.py", line 384, in <module>
from .stats import *
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\stats\stats.py", line 179, in <module>
from scipy.spatial.distance import cdist
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\spatial\__init__.py", line 102, in <module>
from ._procrustes import procrustes
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\spatial\_procrustes.py", line 11, in <module>
from scipy.linalg import orthogonal_procrustes
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\__init__.py", line 195, in <module>
from .misc import *
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs
File "C:\Users\terry\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\scipy\linalg\blas.py", line 215, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed: The specified module could not be found.
My versions are as follows:
Python: 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 01:54:44) [MSC v.1916 64 bit (AMD64)]
scipy: 1.4.1
numpy: 1.18.0
matplotlib: 3.1.2
pandas: 0.25.3
Please what do I need to do to fix my errors?
I am leaving this up to help others, I found the solution, had to unistall completely, reinstall and changing the reg file to allow long path download may have played a role in the beginning.

How to install tflearn, Anaconda Ubuntu 16.04

I am using Anaconda on ubuntu 16.04.
I try pip install tflearn on terminal and says ok.
But if I try to check the tflearn version, I receive this log.
I appreciate any hint to solve this issue.
Traceback (most recent call last):
File "/media/libardo/Datos/Proyectos/Libardo/2017/Proyectos/Kaggle/MBA/prueba_TF_Version.py", line 12, in <module>
import tflearn as tfl; print(tfl.__version__)
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tflearn/__init__.py", line 4, in <module>
from . import config
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tflearn/config.py", line 5, in <module>
from .variables import variable
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tflearn/variables.py", line 7, in <module>
from tensorflow.contrib.framework.python.ops import add_arg_scope as contrib_add_arg_scope
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 30, in <module>
from tensorflow.contrib import factorization
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/factorization/__init__.py", line 24, in <module>
from tensorflow.contrib.factorization.python.ops.gmm import *
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/factorization/python/ops/gmm.py", line 27, in <module>
from tensorflow.contrib.learn.python.learn.estimators import estimator
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/__init__.py", line 87, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/__init__.py", line 23, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 25, in <module>
from tensorflow.contrib.learn.python.learn import estimators
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/__init__.py", line 297, in <module>
from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn.py", line 29, in <module>
from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 31, in <module>
from tensorflow.contrib.learn.python.learn.estimators import estimator
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 49, in <module>
from tensorflow.contrib.learn.python.learn.learn_io import data_feeder
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/__init__.py", line 21, in <module>
from tensorflow.contrib.learn.python.learn.learn_io.dask_io import extract_dask_data
File "/home/libardo/anaconda3/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 26, in <module>
import dask.dataframe as dd
File "/home/libardo/anaconda3/lib/python3.6/site-packages/dask/dataframe/__init__.py", line 3, in <module>
from .core import (DataFrame, Series, Index, _Frame, map_partitions,
File "/home/libardo/anaconda3/lib/python3.6/site-packages/dask/dataframe/core.py", line 38, in <module>
pd.computation.expressions.set_use_numexpr(False)
AttributeError: module 'pandas' has no attribute 'computation'
Maybe the pandas version is old. Try follow the following steps:
https://www.scipy.org/install.html
Another reason for your problem can be due your version of Python, like too the version of your pip. Please, verify if your pip have that libraries with:
pip list
pip2 list
pip3 list
The use of this commands depends your Python and pip version.

I get ImportError: libpng16.so.16 only in virtualenv (ubuntu 14.04, python 2.7.6)

While using matplotlib.pyplot in python interpreter in virtual environment I get this error :
>>> import matplotlib.pyplot as a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/haz/Envs/DataVizProj/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "/home/haz/Envs/DataVizProj/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "/home/haz/Envs/DataVizProj/local/lib/python2.7/site-packages/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/home/haz/Envs/DataVizProj/local/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 62, in <module>
import matplotlib.textpath as textpath
File "/home/haz/Envs/DataVizProj/local/lib/python2.7/site-packages/matplotlib/textpath.py", line 18, in <module>
from matplotlib.mathtext import MathTextParser
File "/home/haz/Envs/DataVizProj/local/lib/python2.7/site-packages/matplotlib/mathtext.py", line 60, in <module>
import matplotlib._png as _png
ImportError: libpng16.so.16: cannot open shared object file: No such file or directory
I have already installed ZLIB , FREETYPE , LIBPNG for matplotlib and I
only get this error in virtualenv.I am a beginner and following this tutorial.
Btw I don't use anaconda or canopy .Just python2.7

Python import error invalid ELF header

When I try to use this command line to run this python code:
~/Tools/find_differential_primers/utils python stitch_six_frame_stops.py seq.fa
Error code will be displayed as followed. could you help me solve this problem.
Traceback (most recent call last):
File "stitch_six_frame_stops.py", line 55, in <module>
import matplotlib
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8 intel.egg/matplotlib/__init__.py", line 129, in <module>
from matplotlib.cbook import is_string_like
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/cbook.py", line 28, in <module>
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/__init__.py", line 140, in <module>
from . import add_newdocs
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/__init__.py", line 6, in <module>
from .type_check import *
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/__init__.py", line 6, in <module>
from . import multiarray
ImportError: /usr/local/lib/python2.7/dist-packages/numpy-1.8.0.dev_3084618_20130514-py2.7-macosx-10.8-intel.egg/numpy/core/multiarray.so: invalid ELF header
You are trying to use a .so file in Mac OSX! .so files work on Linux; Mac OSX works with .dynld files. You probably may want to verify your NumPy Installation.
Assuming you are using OSX Lion, please see here for how to install NumPy on the OSX.

Categories

Resources