olivettigroup/article-downloader

articledownloader not found

Closed this issue · 7 comments

Hi

I have installed articledownloader using pip install articledownloader. When I try to run a python script, it shows that article downloader is not found.

It will be great if I can get any help on this.

This should work if you install via pip. To reproduce/confirm that it works, I tried the following:

# Create a fresh conda environment
conda create --name test_env
conda activate test_env

# Now from within the fresh test environment...
conda install pip
pip install articledownloader

# For some reason, dependencies didn't install correctly for me
pip install requests autologging htmlparser

# Then launch python...
python

From within python:

from articledownloader.articledownloader import ArticleDownloader()
ad = ArticleDownloader()

The above worked for me, so hopefully it's just a local environment / installation issue. Hope that works.

FWIW this repo could probably use a minor cleanup at some point. I wouldn't call it a priority, but it seems like there are some cases where installing out of the box doesn't work as expected.

cc @elsaolivetti (just as an FYI -- idk if this repo is still used in production.)

Hello

Thanks for the reply. I did try installing using pip. Also, I have tried using 'pip install requests autologging htmlparser' to see if it works. Unfortunately, it did not help.

Thanks for the update.

As a next step, could you provide as much detail as possible in terms of:

  1. A step-by-step of what you did
  2. What errors / warnings / logs you saw
  3. What you expected you should see if everything is working correctly

Please post back here with those details when you're able to assemble them!

Hello. Thanks for the reply.

Following are the steps that I have performed:

  1. Typed pip install articeldownloader in the anaconda prompt to install the module
  2. In Spyder, I ran the following sample script

from articledownloader.articledownloader import ArticleDownloader

ad = ArticleDownloader()
downloader = ArticleDownloader()
sample_pdf=open('firstpdf.pdf','w')
downloader.get_pdf_from_doi('10.1021/ja027870w', sample_pdf, 'acs')

  1. I get an error which looks as follows:

ModuleNotFoundError: No module named 'articledownloader.articledownloader'; 'articledownloader' is not a package

I hope this helps. Kindly let me know if you need any more details from my side.

Based on your description, my best guess is that you are successfully installing the package via pip, but when you run python to use the module, you are running from a different environment (and/or don't have PYTHONPATH set correctly) and so the module cannot be found.

Since you're using anaconda, I would recommend verifying that you are running python from the same environment under which you installed the module using pip.

As another double check, you could see if you run into the same issue with other (arbitrary) libraries: Find some module you don't have, try installing via the method you describe, and see if it is now available. If you get the same error, then I would strongly suspect that you are installing/running from separate environments.

Hi

Thank you. It worked. It was a silly mistake from my side. I had another sample python file named articledownloader.py and that was getting called whenever I tried to import article downloader.