2

I am working in a conda environment (called python36)

I have installed a package 'bctpy' while in this environment via

pip install bctpy

When I now try to import this module (while still in this environment)

import bctpy  

I receive the error:

ModuleNotFoundError: No module named 'bctpy'

When I run:

conda list 

from the command prompt the module is there, but when in python I run

help()
modules 

The outputs of which pip and which python are below:

(python36) bash-4.1$ which pip
/home/.conda/envs/python36/bin/pip
(python36) bash-4.1$ which python
/home/.conda/envs/python36/bin/python

It is not visible. is anyone able to explain what is going wrong?

RobMcC
  • 392
  • 2
  • 7
  • 20

2 Answers2

1

This is a problem that one can encounter every now and then:

The PIP package is derived from the PyPI name bctpy

pip install bctpy

but the import name is derived from the top level directory name: bct/, so it must be imported like

import bct
Nils Werner
  • 34,832
  • 7
  • 76
  • 98
  • Many thanks Nils, could you let me know how you worked that out? – RobMcC Aug 06 '18 at 09:08
  • @RobMcC Perhaps differently, but if you see my comment, you see how I worked it out: tests can work great as simple examples of a package's usage. – 9769953 Aug 06 '18 at 09:19
-1

Since i could not get it after my pip install ImageHash i tried following 1. Update index in Anaconda 2. Update channel

None of them helped.

but when i went to Anaconda -> Environments tab -> Click on triangle mark next to base(root) -> Open terminal -> ran command conda install -c conda-forge imagehash

Immediately after this i was able to see the package.