There is, apparently, a package loaded in our Python/2.7.2 environment named CrossMap which has, as a subpackage, tabix. When I start this version of python and import tabix, tabix shows: /hpcf/apps/python/install/2.7.2/lib/python2.7/site-packages/CrossMap-0.1.6-py2.7-linux-x86_64.egg/tabix/__init__.pyc Indicating that it is being loaded from CrossMap. Now, even if I pip install pytabix (which creates a tabix.so file in the site-packages directory), it still hits the CrossMap version. I even tried installing pytabix localling with pip install --user pytabix, but it still loads the CrossMap version.
How can I point import tabix to the tabix.so file instead of the subpackage of CrossMap?
UPDATE: Even after moving CrossMap to 'old_versions' directory, when I try to load tabix, it still hits a different package which has tabix as a subpackage. When I import tabix and then run tabix, I get a pysam package from RSeQC-2.6.1 even though I have pytabix as it's own package in the main site-packages directory. This same thing happens with the pysam package. Any ideas here?
__ builtin __ is imported by default on all program run. type, str, dir, and all the rest of Python's built-in functions are grouped into a special module called __ builtin __ . (That's two underscores before and after.)
Import order does not matter. If a module relies on other modules, it needs to import them itself. Python treats each . py file as a self-contained unit as far as what's visible in that file.
The __init__.py file lets the Python interpreter know that a directory contains code for a Python module. An __init__.py file can be blank. Without one, you cannot import modules from another folder into your project. The role of the __init__.py file is similar to the __init__ function in a Python class.
In Python, ImportError occurs when the Python program tries to import module which does not exist in the private table. This exception can be avoided using exception handling using try and except blocks. We also saw examples of how the ImportError occurs and how it is handled.
You may be able to use a .pth file in the python version's site-packages folder to manually sort the sys.path for a user. easy_install uses this to add an eggs contents to your path as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With