Shaun Ziqin Rong Shaun Ziqin Rong - 25 days ago 5x
Python Question

Can't import by library name, even though I have python develop it

I am running into a very strange python import problem. I wrote my own repo, and used a script to setup the import path, script below:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals

from setuptools import setup, find_packages

__author__ = 'Shaun Rong'
__version__ = '0.1'
__maintainer__ = 'Shaun Rong'
__email__ = ''

if __name__ == "__main__":
author="Ziqin (Shaun) Rong, Wenxuan Huang",
license="MIT License",

I used
python develop
to run the codes. Now, however, I can't import the whole library by name Quantomic, any codes like

import Quantomic


from Quantomic import settings

will raise the error:
ImportError: No module named Quantomic

I do have a
under the library root, and I checked
is in the path.

I do, however, can import using relative paths in any codes inside Quantomic, using like

import settings

will work OK.

Can anyone tell me what is going on? I am happy to provide more information upon request!


File/Folder structure looks like:



Your file is in the wrong directory. Here is your folder structure


It should look like this

/Quantomic (can be named anything)

When you last ran, it likely installed a data library into your python installation. Or, because you used develop, it added the path above data to the pythonpath using a pth file in your python libs folder.