Pytest can not find a package

Problem description

Jimmy (xiaoke) Shen
1 min readApr 27, 2020

When I run the pytest and got the following error.

ModuleNotFoundError: No module named ‘***'

I was using conda and when I go to the python interactive mode, I can import the package from there.

The solution to fix the problem

It seems there is a path conflict between the default pytest and the pytest installed by conda. What I did to fix the issue was install pytest through conda by using the command below:

conda install -c anaconda pytest

Then everything works.

--

--

No responses yet