facebookresearch / nevergrad

A Python toolbox for performing gradient-free optimization
https://facebookresearch.github.io/nevergrad/
MIT License
3.92k stars 352 forks source link

ModuleNotFoundError: No module named 'nevergrad' #1342

Open lzhhh93 opened 2 years ago

lzhhh93 commented 2 years ago

Steps to reproduce

  1. pip install nevergrad
  2. run a script from cmd using 'python muzero.py' from https://github.com/werner-duvaud/muzero-general

Observed Results

Then shows the error:

     Traceback (most recent call last):
  File "muzero.py", line 10, in <module>
    import nevergrad
ModuleNotFoundError: No module named 'nevergrad'

Expected Results

no this error, since in pycharm, it shows that nevergrad is successfully installed

Relevant Code

pip install nevergrad
bottler commented 2 years ago

What was the output of the command pip install nevergrad?

lzhhh93 commented 2 years ago

What was the output of the command pip install nevergrad?

`C:\Users\lzhhh>pip install nevergrad

Requirement already satisfied: nevergrad in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (0.4.3.post9)

Requirement already satisfied: typing-extensions>=3.6.6 in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (from nevergrad) (4.0.0)

Requirement already satisfied: numpy>=1.15.0 in c:\users\lzhhh\appdata\roaming\python\python37\site-packages (from nevergrad) (1.21.4)

Requirement already satisfied: bayesian-optimization>=1.2.0 in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (from nevergrad) (1.2.0)

Requirement already satisfied: cma>=2.6.0 in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (from nevergrad) (3.1.0)

Requirement already satisfied: scipy>=0.14.0 in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (from bayesian-optimization>=1.2.0->nevergrad) (1.7.2)

Requirement already satisfied: scikit-learn>=0.18.0 in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (from bayesian-optimization>=1.2.0->nevergrad) (1.0.2)

Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn>=0.18.0->bayesian-optimization>=1.2.0->nevergrad) (3.0.0)

Requirement already satisfied: joblib>=0.11 in c:\users\lzhhh\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn>=0.18.0->bayesian-optimization>=1.2.0->nevergrad) (1.1.0)`

bottler commented 2 years ago

Something odd is going on with paths. Do you have more than one python install? What happens if you start python on the cmd line and type import sys; sys.path? And if you type import nevergrad?

lzhhh93 commented 2 years ago

Something odd is going on with paths. Do you have more than one python install? What happens if you start python on the cmd line and type import sys; sys.path? And if you type import nevergrad?

Yes i have python3.6 and 3.7 installed. image

bottler commented 2 years ago

You've installed nevergrad for the python 3.7 (look closely at the pip output) and you are trying to use it in python 3.6. As expected this fails. Probably your pip is 3.7 and your python is 3.6. Maybe you can explicitly use pip3.6, pip3.7, python3.6 and python3.7 as required.