1

I do notice there are some similar question asked by different people about why python couldn't locate the packages that are installed using conda install command in their conda environment.

Take pyqt for example.

1 I create conda environment: conda create -n myenv python=2.7 pip

2 Activate environment: source activate myenv

3 install packages: conda install pyqt

4 run python: python import pyqt

Error report: ImportError: No module named pyqt

5 check out packages installed: pip list doesn't give pyqt but conda list will show pyqt installed

6 I just noticed that the "conda install" packges are under /env/conda-meta, but "pip install" packges are under env/lib/python2.7/site-packages (and bunch paths sys.path gives).

If we could simply append the /env/conda-meta to the path, it'll be great, but after appending operation, I eixt() python and re-run python, checking out the sys.path again, the /env/conda-meta is not there anymore.

Does anyone know how to solve it?

Jason
  • 3,166
  • 3
  • 20
  • 37
  • related question found here with better case description (https://stackoverflow.com/questions/51461944/cannot-import-packages-installed-in-new-conda-environment#comment93283513_51461944). But I want to know how to append to sys.path in this situation. – Jason Nov 07 '18 at 20:58
  • Please visit at least one tutorial to see which imports are actually valid https://build-system.fman.io/pyqt5-tutorial – Nehal J Wani Nov 11 '18 at 06:05

1 Answers1

2

The issue is that you're using the wrong module name. The correct import statement for pyqt is

import PyQt5

or whatever version you installed.

merv
  • 67,214
  • 13
  • 180
  • 245