Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError: While running giveme5w1h-rest example. #30

Open
abhimanyuNitSri opened this issue Jan 24, 2019 · 14 comments
Open

FileNotFoundError: While running giveme5w1h-rest example. #30

abhimanyuNitSri opened this issue Jan 24, 2019 · 14 comments
Assignees

Comments

@abhimanyuNitSri
Copy link

abhimanyuNitSri commented Jan 24, 2019

No description provided.

@abhimanyuNitSri
Copy link
Author

abhimanyuNitSri commented Jan 24, 2019

To Reproduce :

$ giveme5w1h-corenlp #starting corenlp

copy the example code from README file of the reposetory under the title "Use within your own code (as a library)"

from Giveme5W1H.extractor.document import Document
from Giveme5W1H.extractor.extractor import MasterExtractor

extractor = MasterExtractor()
doc = Document.from_text(text, date_publish)
# or: doc = Document(title, lead, text, date_publish) 
doc = extractor.parse(doc)

top_who_answer = doc.get_top_answer('who').get_parts_as_text()
print(top_who_answer)

input data such as text, date_publish were taken from
https://github.com/fhamborg/Giveme5W1H/blob/master/Giveme5W1H/examples/extracting/parse_documents.py

Now run the python file containing the above code (I used jupyter notebook)

ERROR:

Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/extractor.py", line 20, in run
    extractor.process(document)
  File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/extractors/abs_extractor.py", line 40, in process
    self._extract_candidates(document)
  File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/extractors/environment_extractor.py", line 147, in _extract_candidates
    self._cache_nominatim.cache(location_string, location)
  File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/tools/key_value_cache.py", line 58, in cache
    self.persist()
  File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/tools/key_value_cache.py", line 43, in persist
    with open(self._cache_path, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/Giveme5W1H/examples/caches/Nominatim.prickle'

OS : MacOs 10.14:
Python Version : 3.6
Giveme5W1H : 1.0.13
Stanford CoreNLP :stanford-corenlp-full-2018-10-05

@abhimanyuNitSri
Copy link
Author

abhimanyuNitSri commented Jan 24, 2019

I was able to run the code by copping the caches folder from the repository Giveme5W1H/examples to my local package folder. I also changed the name of the file inside the caches folder by removing the first "_" character.

@pfmonville
Copy link

I was able to run the code by copping the caches folder from the repository Giveme5W1H.examples to my local package folder. I also changed the name of the file inside the caches folder by removing the first "_" character.

I had the same issue and fixed it the same way you did.

@fhamborg fhamborg self-assigned this Jan 29, 2019
@fhamborg
Copy link
Owner

it seems that when using anaconda or jupyter notebook there are issue with file access (also see #29 )

@abhimanyuNitSri
Copy link
Author

If wget is not pre installed in macOS it cause problem while installing.

@fhamborg
Copy link
Owner

fhamborg commented Jan 29, 2019

no, the issue at hand is that Giveme5W1H is about to create the file Nominatim.prickle but can't, and hence has no writing permission at that location (/usr/local/lib/python3.6/site-packages/Giveme5W1H/examples/caches/). which is because everything under /usr can only be accessed with writing permission by root but on a regular macOS installation not by a regular user.

@fhamborg
Copy link
Owner

@abhimanyuNitSri how exactly did you install Giveme5W1H?

@abhimanyuNitSri
Copy link
Author

abhimanyuNitSri commented Jan 29, 2019

@abhimanyuNitSri how exactly did you install Giveme5W1H?

  1. I manually installed wget
  2. Follow the installing instruction from README file
  3. copied the caches folder from the repository Giveme5W1H/examples to my local package folder.
  4. changed the name of the file inside the caches folder by removing the first "_" character.

If someone have attempted installing before and failed then this might not work as few files are created while installing and are not removed when uninstalling Giveme5W1H. And those previously create file create problem while reinstalling

So for that problem user have to manual delete folders(which where created while initial installing process : "Giveme5W1H" and "giveme5w1h-1.0.13.dist-info") from there /usr/local/lib/python3.6/site-packages/ and then repeat the above steps.

@abhimanyuNitSri
Copy link
Author

@abhimanyuNitSri how exactly did you install Giveme5W1H?
@fhamborg
Sir, I want to work and contribute to open source libraries so please let me know, if I can be of some help to you.

@rahulbot
Copy link

I had the same problem, installing via pypi. Copying in the caches dir by hand fixed it for me as well.

@abhimanyuNitSri
Copy link
Author

I had the same problem, installing via pypi. Copying in the caches dir by hand fixed it for me as well.

which operating system are you using.

@rahulbot
Copy link

rahulbot commented Feb 4, 2019

I'm using macOS 10.14.2. Python3 installed with pyenv. Giveme5W1H installed with PyPi.

@anarkia7115
Copy link

I was able to run the code by copping the caches folder from the repository Giveme5W1H/examples to my local package folder. I also changed the name of the file inside the caches folder by removing the first "_" character.

Same issue. Installed using pip. And fixed it the same way you did.

@ogencoglu
Copy link

Same issue here. Ubuntu16, python3.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants