c-okelly / org_to_anki

Python3 module to convert Txt, Org or LibreOffice files into Anki decks
MIT License
64 stars 10 forks source link

MacOS installation succeeds, but usage fails. #26

Closed sandersantema closed 5 years ago

sandersantema commented 5 years ago

Please follow the template below to report your issue.

Please include the following information:

After a successful install usage of org_to_anki fails with the following output:

Traceback (most recent call last):
  File "/usr/local/bin/org_to_anki", line 11, in <module>
    load_entry_point('org-to-anki==0.1', 'console_scripts', 'org_to_anki')()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'org_to_anki'

What is your operating system

Mac OS 10.13.6 Python 3.7.3

sandersantema commented 5 years ago

I've tried the following but usage still fails:

cd dist
python3 -m easy_install org_to_anki-0.1-py3.7.egg

Which gives the following output:

Password:
Processing org_to_anki-0.1-py3.7.egg
removing '/usr/local/lib/python3.7/site-packages/org_to_anki-0.1-py3.7.egg' (and everything under it)
creating /usr/local/lib/python3.7/site-packages/org_to_anki-0.1-py3.7.egg
Extracting org_to_anki-0.1-py3.7.egg to /usr/local/lib/python3.7/site-packages
org-to-anki 0.1 is already the active version in easy-install.pth
Installing ankiq script to /usr/local/bin
Installing org_to_anki script to /usr/local/bin

Installed /usr/local/lib/python3.7/site-packages/org_to_anki-0.1-py3.7.egg
Processing dependencies for org-to-anki==0.1
Finished processing dependencies for org-to-anki==0.1

And then again fails with the following output:

Traceback (most recent call last):
  File "/usr/local/bin/org_to_anki", line 11, in <module>
    load_entry_point('org-to-anki==0.1', 'console_scripts', 'org_to_anki')()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
    return self.resolve()
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'org_to_anki'
c-okelly commented 5 years ago

I assume you ran python3 setup.py install to install if the first time?

What command are you running to get the particular error? Are you trying to run it on the command line or are you trying to import the library in a script?

sandersantema commented 5 years ago

I indeed ran python3 setup.py install to install it. I tried running anki_to_org and ankiq which both return the same error. I troed running it on the commandline.

sandersantema commented 5 years ago

Pip packages install perfectly fine, if it’s not to much asked maybe that would be a better way to distribute anki_to_org? (Although that might be a lot of work, I’m not really familiar with pip)

c-okelly commented 5 years ago

It probably is a better way tbh but I have just not got around to doing it yet. I'm also running on OSX and installing as it suggested in the documentation and can't seem to reproduce your error.

My best guess would possibly be that you used a different version of Python to install it to the one the is running when you are on the command line. Thought thb I'm just guessing.

Also how did you install python3? What do you get when you run the following? which python3 python3 -V

c-okelly commented 5 years ago

I will distributed to pip at some point but a lot of the project is still quite rough and had not got around to it yet

c-okelly commented 5 years ago

The Anki addon does appear to be working for most users if you want to try that instead? IT does support org files of course.

https://ankiweb.net/shared/info/1029306148

sandersantema commented 5 years ago

which python returns the following: /usr/local/bin/python3

python3 -V returns the following: Python 3.7.3

I've fiddled around a bit, updating packages, changing my path etc but unfortunately to no avail.

The Anki package seems to work, didn't know it existed, thank you!

I'd still like to solve this problem so I can use anki_to_org in a script, so if you need anymore information please ask. Although it might not have anything to do with org_to_anki but rather with my local python setup :(

Anyways, thanks for the nice plugin.

c-okelly commented 5 years ago

I'm not really sure. I will try and test if on a few other environments and see if I can replicate the issue. I would still be inclined to think it is an issue with different versions of Python. Especially since it seems the command is added to your path but then fails to find the module.

My other suggestion would be to possibly uninstall python3 and try reinstall it with a package manager such a homebrew and running brew doctor and see if that fixes anything? Though if you are already using brew i'm really not sure then

c-okelly commented 5 years ago

Ok issue is def on my end was able to replicate it on a virtual machine. Am looking into it

c-okelly commented 5 years ago

I believe this is solved by a0f5e9c9821c1184e79fe980a4829a83512b6ef4

I have made sure to test it locally, on a Linux Vm and added automated testing to catch breaking changes like this in futures.

I have disabled ankiq as is was not properly testing and I don't know if it was working.

Let me know if you still have issues

sandersantema commented 5 years ago

Succes! But only when using pip3 install ./ in the org_to_anki repo, this might be caused by python3 setup.py install not cleaning up leftovers from previous installation attempts properly if I were to take a guess.

c-okelly commented 5 years ago

Maybe try pip3 uninstall org_to_anki ?

c-okelly commented 5 years ago

Glad to hear it is working. Hopefully testing in will capture a break like this in future. I had not thought to test it but it is done now!