Hydra: [Bug] ModuleNotFoundError: No module named 'hydra.experimental'; 'hydra' is not a package

Created on 25 Aug 2020  路  9Comments  路  Source: facebookresearch/hydra

馃悰 Bug

Description

ModuleNotFoundError: No module named 'hydra.experimental'; 'hydra' is not a package

Checklist

  • [x] I checked on the latest version of Hydra
  • [x] I created a minimal repro

To reproduce

from hydra.experimental import initialize, compose

    from hydra.experimental import initialize, compose
ModuleNotFoundError: No module named 'hydra.experimental'; 'hydra' is not a package

Expected Behavior

jast works

System information

Hydra: hydra-core-1.0.0rc4
OS: Ubuntu 18.04.5 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: Could not collect

Python version: 3.6 (64-bit runtime)
Is CUDA available: N/A
CUDA runtime version: 9.1.85
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect

Versions of relevant libraries:
[pip3] numpy==1.19.0
[conda] Could not collect

question

Most helpful comment

OP probably installed the package Hydra with pip install hydra instead of the correct pip install hydra-core --upgrade.

I did the same mistake and had a similar error message:

ModuleNotFoundError: No module named 'hydra.core'; 'hydra' is not a package

All 9 comments

Please show pip freeze output.

@omry

(base) user@s130:~$ pip install hydra-core --upgrade --pre
Requirement already up-to-date: hydra-core in ./anaconda3/lib/python3.7/site-packages (1.0.0rc4)
Requirement already satisfied, skipping upgrade: importlib-resources; python_version < "3.9" in ./anaconda3/lib/python3.7/site-packages (from hydra-core) (3.0.0)
Requirement already satisfied, skipping upgrade: omegaconf>=2.0.1rc12 in ./anaconda3/lib/python3.7/site-packages (from hydra-core) (2.0.1rc12)
Requirement already satisfied, skipping upgrade: antlr4-python3-runtime==4.8 in ./anaconda3/lib/python3.7/site-packages (from hydra-core) (4.8)
Requirement already satisfied, skipping upgrade: zipp>=0.4; python_version < "3.8" in ./anaconda3/lib/python3.7/site-packages (from importlib-resources; python_version < "3.9"->hydra-core) (3.1.0)
Requirement already satisfied, skipping upgrade: PyYAML>=5.1.* in ./anaconda3/lib/python3.7/site-packages (from omegaconf>=2.0.1rc12->hydra-core) (5.3.1)
Requirement already satisfied, skipping upgrade: typing-extensions in ./anaconda3/lib/python3.7/site-packages (from omegaconf>=2.0.1rc12->hydra-core) (3.7.4.3)

it looks like I chose the wrong interpreter :褋

Is it possible to somehow derive a version hydra from Python?

Is it possible to somehow derive a version hydra from Python?

You can run
python -m pip freeze | grep hydra to get the Hydra version

It looks like an installation issue, could you start with a fresh conda env and try reinstall Hydra?

@paantya:
I asked for the output of pip freeze and you show me the output of pip install.

@omry

(base) user@s130:~$ pip install hydra-core --upgrade --pre
Requirement already up-to-date: hydra-core in ./anaconda3/lib/python3.7/site-packages (1.0.0rc4)
Requirement already satisfied, skipping upgrade: importlib-resources; python_version < "3.9" in ./anaconda3/lib/python3.7/site-packages (from hydra-core) (3.0.0)
Requirement already satisfied, skipping upgrade: omegaconf>=2.0.1rc12 in ./anaconda3/lib/python3.7/site-packages (from hydra-core) (2.0.1rc12)
Requirement already satisfied, skipping upgrade: antlr4-python3-runtime==4.8 in ./anaconda3/lib/python3.7/site-packages (from hydra-core) (4.8)
Requirement already satisfied, skipping upgrade: zipp>=0.4; python_version < "3.8" in ./anaconda3/lib/python3.7/site-packages (from importlib-resources; python_version < "3.9"->hydra-core) (3.1.0)
Requirement already satisfied, skipping upgrade: PyYAML>=5.1.* in ./anaconda3/lib/python3.7/site-packages (from omegaconf>=2.0.1rc12->hydra-core) (5.3.1)
Requirement already satisfied, skipping upgrade: typing-extensions in ./anaconda3/lib/python3.7/site-packages (from omegaconf>=2.0.1rc12->hydra-core) (3.7.4.3)

From your output it would appear that you installed hydra in your base conda environment. this strikes me as a mistake or as a terrible idea.

Closing under the assumption that you have an installation issue and/or you installed the wrong Hydra package.

OP probably installed the package Hydra with pip install hydra instead of the correct pip install hydra-core --upgrade.

I did the same mistake and had a similar error message:

ModuleNotFoundError: No module named 'hydra.core'; 'hydra' is not a package
Was this page helpful?
0 / 5 - 0 ratings