jdrumgoole / gdelttools

Scripts to load the GDELT data set into MongoDB
Apache License 2.0
7 stars 6 forks source link

ModuleNotFoundError: No module named 'gdelttools' #5

Closed webchick closed 2 years ago

webchick commented 2 years ago

I'm no Python-ista, so this might well be PEBCAK, but I'm attempting to follow the steps in the GDELT Primer README and getting an error:

% git clone https://github.com/jdrumgoole/gdelttools.git

% cd gdelttools

% pipenv install Pipfile
% Installing Pipfile...
Adding Pipfile to Pipfile's [packages]...
✔ Installation Succeeded 
Pipfile.lock (71ee15) out of date, updating to (ed9182)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success! 
Updated Pipfile.lock (ed9182)!
Installing dependencies from Pipfile.lock (ed9182)...
  🐍   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.

% python gdelttools/gdeltloader.py --master 
Traceback (most recent call last):
  File "/Users/webchick/mongodb-hackathon/gdelttools/gdelttools/gdeltloader.py", line 18, in <module>
    from gdelttools.web import local_path, download_file, compute_md5, extract_zip_file
ModuleNotFoundError: No module named 'gdelttools'

Here's all my versions of various things:

 % python -V
Python 3.9.12
% pip -V
pip 22.0.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
% pipenv --version
pipenv, version 2022.4.8

Any ideas?

stennie commented 2 years ago

pipenv wants you to activate a virtual environment (which should have all the right dependencies) via pipenv shell:

To activate this project's virtualenv, run pipenv shell

webchick commented 2 years ago

Yes, that was the very first thing I tried the other day, but it does this:

% pipenv shell
Launching subshell in virtual environment...
 . /Users/webchick/.local/share/virtualenvs/gdelttools-fuGtk-QA/bin/activate
webchick@Angiez-MacBook-Pro gdelttools %  . /Users/webchick/.local/share/virtualenvs/gdelttools-fuGtk-QA/bin/activate

And like. Then what? Because if I run the same command, I get the same results. (Even tried running it from the /Users/webchick/.local/share/virtualenvs/gdelttools-fuGtk-QA/gdelttools directory, in case that was the thing.)

webchick commented 2 years ago

OK, I see it was buried in the pipenv install output above and i missed it. 🙈 I apparently need to do:

pipenv run python gdelttools/gdeltloader.py --ziplist master

Now it is doing things. :)

If this is correct, it would be SO INCREDIBLY HELPFUL if the README.md just spelled that out. I was not planning to spend my first several hours of the MongoDB Hackathon farting around with getting Python to just work. :D

webchick commented 2 years ago

Nope, I lied, now it's back to my original problem where it's complaining about ModuleNotFoundError: No module named 'requests' 😭

ANYWHO. I would love just a straight-forward, "copy and paste the following stuff into Terminal and everything works" thing vs. having to read up on the inner workings of pipenv and whatnot to figure out what to do next. Your README PR comes incredibly close, but I think people unfamiliar with Python still need a bit more hand-holding. (Or maybe my laptop is just "special" ;))

jdrumgoole commented 2 years ago

Working on a fix for this Angie.

On Sat 16 Apr 2022, 8:33 AM Angie Byron, @.***> wrote:

Nope, I lied, now it's back to my original problem where it's complaining about ModuleNotFoundError: No module named 'requests' 😭

ANYWHO. I would love just a straight-forward, "copy and paste the following stuff into Terminal and everything works" thing vs. having to read up on the inner workings of pipenv and whatnot to figure out what to do next. Your README PR comes incredibly close, but I think people unfamiliar with Python still need a bit more hand-holding. (Or maybe my laptop is just "special" ;))

— Reply to this email directly, view it on GitHub https://github.com/jdrumgoole/gdelttools/issues/5#issuecomment-1100595324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXYDUJBXU67BJREO7HWM3VFJUOHANCNFSM5TRSLDXA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Fiewor commented 2 years ago

I've been battling with this exact same thing. @jdrumgoole Glad you had mentioned it @webchick

Fiewor commented 2 years ago

OK, I see it was buried in the pipenv install output above and i missed it. 🙈 I apparently need to do:

pipenv run python gdelttools/gdeltloader.py --ziplist master

Now it is doing things. :)

If this is correct, it would be SO INCREDIBLY HELPFUL if the README.md just spelled that out. I was not planning to spend my first several hours of the MongoDB Hackathon farting around with getting Python to just work. :D

Exactly. The README would be a bit more readable for devs that aren't too familiar with python if an instruction like:

To get started either install the prerequisites from the Pipfile or use pipenv shell to create a virtual environment and have pipenv do the work for you.

was more detailed

webchick commented 2 years ago

OK sweet, after the changes that were just made to reformulate this repo as an official python project https://test.pypi.org/project/gdelttools/ and the small tweaks to README committed as part of #6, this is now working for me.

@Fiewor, if you have a second, can you re-try your install using the new instructions in the README of this repo and see if you also meet with success?

jdrumgoole commented 2 years ago

I think these issues are fixed. Can you try and install https://pypi.org/project/gdelttools/ and see if it works now. As always reraise this and new issues here.

jdrumgoole commented 1 year ago

Hi John,

I updated the README this morning. Ultimately I plan to make a proper package which will eliminate all this cruft.

Joe

On Sat 16 Apr 2022, 2:36 PM Fiewor John, @.***> wrote:

OK, I see it was buried in the pipenv install output above and i missed it. 🙈 I apparently need to do:

pipenv run python gdelttools/gdeltloader.py --ziplist master

Now it is doing things. :)

If this is correct, it would be SO INCREDIBLY HELPFUL if the README.md just spelled that out. I was not planning to spend my first several hours of the MongoDB Hackathon farting around with getting Python to just work. :D

Exactly. The README would be a bit more readable for devs that aren't too familiar with python if an instruction like:

To get started either install the prerequisites from the Pipfile or use pipenv shell to create a virtual environment and have pipenv do the work for you.

was more detailed

— Reply to this email directly, view it on GitHub https://github.com/jdrumgoole/gdelttools/issues/5#issuecomment-1100664916, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXYDTDKZ3MJEALDIZLHTLVFK657ANCNFSM5TRSLDXA . You are receiving this because you were mentioned.Message ID: @.***>