fabiobatalha / crossrefapi

A python library that implements the Crossref API.
BSD 2-Clause "Simplified" License
265 stars 44 forks source link

'crossref' is not a package error #17

Closed mneedham91 closed 6 years ago

mneedham91 commented 6 years ago

I installed crossrefapi using pip, it seemed to install fine. When I attempted to use it, got the following error: ModuleNotFoundError: No module named 'crossref.restful'; 'crossref' is not a package

Here was my code

from crossref.restful import Journals

journals = Journals()

print(journals.journal('1759-3441'))
fabiobatalha commented 6 years ago

This is probably a issue with your environment.

You need to check where pip is installing the libraries, if the crossrefapi was installed in the correct site package (if you have more them one version of python in you machine), if the sys.path is correct and if there are no conflict names with other libraries.

ThinkPad:~/Work/ots_docker$ python -m site
sys.path = [
    '/home/fabiobatalha/Work/ots_docker',
    '/usr/lib/python2.7',
    '/usr/lib/python2.7/plat-x86_64-linux-gnu',
    '/usr/lib/python2.7/lib-tk',
    '/usr/lib/python2.7/lib-old',
    '/usr/lib/python2.7/lib-dynload',
    '/home/fabiobatalha/.local/lib/python2.7/site-packages',
    '/usr/local/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages',
    '/usr/lib/python2.7/dist-packages/gtk-2.0',
]
USER_BASE: '/home/fabiobatalha/.local' (exists)
USER_SITE: '/home/fabiobatalha/.local/lib/python2.7/site-packages' (exists)
ENABLE_USER_SITE: True

A good way to have an isolated environment is using virtualenv.

mneedham91 commented 6 years ago

@fabiobatalha I'm not sure what the issue was, but creating a new project in PyCharm with a fresh virtualenv did the trick. Thanks for your quick help.