I have installed conda and created a python3.7 environment. Then I have installed pandas and now I'm getting the following error when I try to import pandas.
Traceback (most recent call last):
File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
ImportError: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 37, in <module>
ImportError: C extension: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --force' to build the C extensions first.Traceback (most recent call last):
File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
ImportError: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 37, in <module>
ImportError: C extension: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --force' to build the C extensions first.
Any ideas?
It turns out this is a bug with conda and pandas.
Here is the ticket:
BUG: Pandas Import is failing under Conda Python 3.7
Using conda-forge fixed the issue for me.
Related
After installing Anaconda in Windows I get the following error when trying to use it:
conda command
:
Traceback (most recent call last):
File "C:\Users\mohamed\Anaconda3\Scripts\conda-script.py", line 11, in <module>
from conda.cli import main
ModuleNotFoundError: No module named 'conda'
anaconda command
:
Traceback (most recent call last):
File "C:\Users\mohamed\anaconda3\Scripts\anaconda-script.py", line 6, in <module>
from binstar_client.scripts.cli import main
ModuleNotFoundError: No module named 'binstar_client'
I tried to delete and reinstall anaconda several times but useless
I have tried upgrading Python version on a Miniconda installation by running conda update python. The version was being taken from 3.8 to 3.10. This seems to have broken the installation. No matter what command I run, I get the following:
➜ project conda activate
Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/serialize.py", line 13, in <module>
import ruamel_yaml as yaml
ModuleNotFoundError: No module named 'ruamel_yaml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/serialize.py", line 16, in <module>
import ruamel.yaml as yaml
ModuleNotFoundError: No module named 'ruamel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/user/miniconda3/bin/conda", line 15, in <module>
sys.exit(main())
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/cli/main.py", line 118, in main
from ..exceptions import conda_exception_handler
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/exceptions.py", line 24, in <module>
from .models.channel import Channel
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/models/channel.py", line 17, in <module>
from ..base.context import context, Context
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/base/context.py", line 55, in <module>
from ..common.configuration import (Configuration, ConfigurationLoadError, MapParameter,
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/configuration.py", line 42, in <module>
from .serialize import yaml_round_trip_load
File "/home/user/miniconda3/lib/python3.10/site-packages/conda/common/serialize.py", line 18, in <module>
raise ImportError("No yaml library available. To proceed, conda install ruamel_yaml")
ImportError: No yaml library available. To proceed, conda install ruamel_yaml
Help on fixing this is appreciated.
You can find the C code in this temporary file:
/tmp/theano_compilation_error_7_ntcw7n
Traceback (most recent call last):
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 81, in <module>
actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 105, in <module>
actual_version, force_compile, _need_reload))
ImportError: Version check of the existing lazylinker compiled file. Looking for version 0.211, but found None. Extra debug information: force_compile=False, _need_reload=True
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/__init__.py", line 110, in <module>
from theano.compile import (
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/compile/__init__.py", line 12, in <module>
from theano.compile.mode import *
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/compile/mode.py", line 11, in <module>
import theano.gof.vm
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/vm.py", line 674, in <module>
from . import lazylinker_c
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/lazylinker_c.py", line 140, in <module>
preargs=args)
File "/home/vaishnavnimkar/.local/lib/python3.7/site-packages/theano/gof/cmodule.py", line 2396, in compile_str
(status, compile_stderr.replace('\n', '. ')))
Exception: Compilation failed (return status=1): /home/vaishnavnimkar/.theano/compiledir_Linux-5.2-2parrot1-amd64-x86_64-with-Parrot-4.7-stable--3.7.4+-64/lazylinker_ext/mod.cpp:1:10: fatal error: Python.h: No such file or directory. 1 | #include <Python.h>. | ^~~~~~~~~~. compilation terminated..
You need to install the python-dev extensions for proper header-files. For Debian distributions package is python3-dev which can be installed with apt-get. For Redhat distributions its python3-devel which might be installed with yum
I hope this should solve your problem.
I use python3.5, i recently installed spamc using pip.
When i try to import spamc, an error is raised:
How can i resolve this error?Should i find and install other library where spamc is included in it?
import spamc
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import spamc
File "/usr/local/lib/python3.5/dist-packages/spamc/__init__.py", line 24, in <module>
from spamc.client import SpamC
File "/usr/local/lib/python3.5/dist-packages/spamc/client.py", line 230
except socket.gaierror, err:
^
SyntaxError: invalid syntax
I can import mingus but sublibraries such as mingus.extra.lilypond give me an error:
import mingus.core.notes
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import mingus.core.notes
File "C:\Users\PharaohZz\AppData\Local\Programs\Python\Python36\lib\site-packages\mingus\core\notes.py", line 29, in <module>
from mt_exceptions import NoteFormatError, RangeError, FormatError
ModuleNotFoundError: No module named 'mt_exceptions'
or
import mingus.extra.lilypond
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import mingus.extra.lilypond
File "C:\Users\PharaohZz\AppData\Local\Programs\Python\Python36\lib\site-packages\mingus\extra\__init__.py", line 20, in <module>
import lilypond
ModuleNotFoundError: No module named 'lilypond'
You can fix this problem by first uninstalling mingus (pip uninstall mingus).
Then build the library from it's source. To do this:
Download the files from git hub using the command git clone https://github.com/bspaans/python-mingus .
Enter the directory using cd python-mingus.
Finally install it using the command python setup.py install.
This fixed the problem for me.