Python Pandas - Missing required dependencies ['numpy'] 1

前端 未结 28 2286
清歌不尽
清歌不尽 2020-11-27 16:32

Since yesterday I\'ve had this error when I try to import packages on anaconda :

ImportError: Missing required dependencies [\'numpy\']

I have t

相关标签:
28条回答
  • 2020-11-27 17:02

    pandas is built on top of numpy so you need to have numpy to use the data manipulation feature, so install numpy first.

    pip install numpy 
    
    0 讨论(0)
  • 2020-11-27 17:03

    Try:

        sudo apt-get install libatlas-base-dev
    

    It should work now.

    Else, try uninstall and reinstall numpy and pandas.

    0 讨论(0)
  • 2020-11-27 17:04

    This worked in my anaconda environment, but I do not know why conda does not work. For some reason conda uninstall was not sufficient. This only worked with conda remove.

    conda remove pandas
    conda remove numpy
    conda install pip
    pip install pandas
    

    *With help from this answer

    This raises the following import warning in python 3.6 and 3.7:

    ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
    

    If you with to ignore this warning (and maybe other ImportWarnings), add the following to your script before importing pandas:

    import warnings
    warnings.filterwarnings('ignore', category=ImportWarning, module='_bootstrap.py')
    
    0 讨论(0)
  • 2020-11-27 17:05

    Did you install miniconda and pandas without dependencies?

    Try installing numpy first with conda install numpy or pip install numpy.

    If you're on Windows you can get pre-compiled versions of most libraries that require compilation from here.

    0 讨论(0)
  • 2020-11-27 17:05

    I had a same issue recently with Anaconda with Python 3.7.

    I solved this problem by downgrading python version to 3.6:

    conda install python=3.6
    

    and then by updating all the packages:

    conda update --all
    
    0 讨论(0)
  • 2020-11-27 17:05

    In my case even though I was using the above options of uninstall and installing using pip the code was still giving me same errors.

    Finally, I created a vritual environment and Installed numpy and pandas using pip in my virtual env. Now the code is running.

    Steps: for Anaconda3 - Please change according to your installation type: [if you dont have virtual env package installed]

    $ pip install virtualenv
    

    [from command prompt go to the directory by c:\anadonda3\scripts

    [write the following command to use virtual env to create a virtual env for you in your desired location]

    $virtualenv c:\anaconda3\envs\my_virtual_env
    

    [once created you will have to activate your virtual env]

    $c:\anaconda3\envs\my_virtual_env\scripts activate
    

    [now pip install numpy and pandas and other required packages using pip]

    [once installations are done exit from the virtual env]

    $c:\anaconda3\envs\my_virtual_env\scripts deactivate
    

    now use the python.exe inside your virtual env folder to run the script and it will run even with python 3.7.

    0 讨论(0)
提交回复
热议问题