0

For generating circos plots, used the following command to install pycirclize

pip install pycirclize

command ran properly. But when tried executing

from pycirclize import Circos

error thrown. Error message

ModuleNotFoundError: No module named 'pycirclize

Please help how to resolve the error.

Tried re-intstalling pycirclize, but the error is still being flagged.

binaryescape
  • 105
  • 6
  • What python version are you using? – binaryescape Aug 05 '23 at 18:48
  • 1
    The most common cause of this is that you have multiple installations of Python, and you have installed the package in an installation different from the one you're running with. Are you using Jupyter? – Tim Roberts Aug 05 '23 at 18:56
  • Yes I am using Jypyter notebook. – Subrat mohapatra Aug 06 '23 at 15:30
  • Python version 3.11.4 – Subrat mohapatra Aug 06 '23 at 15:41
  • You'll have a better experience not using outdated methods to install from within the notebook. The modern magic install commands `%pip install` (and `%conda install` if you've installed Anaconda/conda and so that is **primary** package manager) were added to insure installation occurs in the environment where the kernel is running that is backing the notebook. The exclamation point in conjunction with install commands doesn't do that and can lead to problems and confusion of the type you are experiencing. To mitigate that the magic install commands were added and are current best practice. – Wayne Aug 06 '23 at 16:13
  • See [here](https://stackoverflow.com/questions/28828917/error-importing-seaborn-module-in-python-importerror-cannot-import-name-utils/76347896#comment134631387_41925357) for more about the user-friendly, modern magic install commands. See the second paragraph [here](https://discourse.jupyter.org/t/location-of-libraries-or-extensions-installed-in-jupyterlab/16303/2?u=fomightez) for more about how the exclamation point use with installs can lead to issues sometimes. – Wayne Aug 06 '23 at 16:14

1 Answers1

0

As mentioned by Tim Roberts, the most common and obvious cause for this is multiple installations of Python, and hence pip. If you're using Jupyter or IPython, you can check your python interpreter using

import sys
sys.executable

This should return a path. In my case: '/home/dev/anaconda3/bin/python'. This is the interpreter used by your notebook. (Your system might have a different python installed for other purposes). By default if you are using !pip from within your notebook, that would be the pip associated with your notebook's python interpreter. If you are using pip from the terminal (or any place other than the notebook), you might need to use

/whatever/sys/executable/returns/path -m pip install pycirclize

This ensures that you are installing packages using the notebook interpreter's associated pip.

PROCEED WITH CAUTION

You can also probe into the different python versions installed in your system. If you're confident that some other python exists which is not used by your system (probably from some earlier installation), you can safely uninstall it. Otherwise just use the above workaround.

Dev Bhuyan
  • 541
  • 5
  • 19