Cannot access installed library from Atom/Hydrogen3

Dear friends,
I use Atom with Hydrogen3 as a friendly environment to learn about Python. Usually all works but now I am trying to run a very simple python3 program that starts with:
import treetaggerwrapper
and while this programs runs well from command line, in Atom I get:

ModuleNotFoundError Traceback (most recent call last)
----> 1 import treetaggerwrapper
ModuleNotFoundError: No module named ‘treetaggerwrapper’

My environment is a MacOS, with Python 3.6 installed globally, conda for most packages but had to install treetagwrapper with pip3.

Any help very welcome thank you in advance.

Have you, by chance, named your test file as
If so then this causes an error since there is a conflict between file name and module name.

On second read it can’t be that if you can run in command line outside Atom.
Launch terminal in Atom and start python and try import at the prompt …

import treetaggerwrapper

Also in Atom terminal run

conda --version
conda list


Are you aware of TagAnt tool?

Thank you very much for trying to help.

Installed platformio-terminal and this is what I get from it within Atom:
(base) bob@rja15 TreeTagger % python -V
Python 3.6.1
(base) bob@rja15 TreeTagger % python
Python 3.6.1 (default, Jul 14 2020, 18:55:41)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.62)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import treetaggerwrapper

so this seems to work well.
Always from the term within Atom:
(base) bob@rja15 TreeTagger % conda --version
conda 4.8.3
while conda list produces a list of 282 installed packages and treetaggerwrapper is not in that list.
As I specified I had to install treetaggerwrapper witth pip3

Any other ideas to help you understand?

I tried installing by conda but I see that it does not install. I am on Ubuntu.

Investigating I see that

shows only win-64 (not linux-64).

whereas other installed conda packages at least show linux-64, osx-64, win-64

perhaps raise this as an issue since there are only 631 downloads of this package so far.

Returning to the pip3 installation you need to ensure that the path to the pip3 installed packages is recognised by Python3 running within Atom.

First run

pip3 list

to check that treetagwrapper is installed
(it is in my pip3)

I tried running python3

import treetaggerwrapper

and found it located here …


but I have not yet explored using this.

[P.S.] Did you miss the reference to TagAnt tool earlier?

I did miss the reference to Tagant. Installed 1.2.0 but it seems not to show any output (tried with a simple short phrase in English and then Italian).

(term from Atom)
(base) bob@rja15 TreeTagger % pip3 list | grep tree
treetaggerwrapper 2.3

FWIW the SAME error from running the code is also true if I try running this in Jupyter and am starting to believe it’s an IPython issue but too ignorant to understand/solve it :frowning:
Thank you

Now I have a new clue :slight_smile:

Tried running a

!pip3 install treetaggerwrapper

from within Jupyter Lab

This is what I got

!pip3 install treetaggerwrapper

Requirement already satisfied: treetaggerwrapper in /Users/bob/.pyenv/versions/3.6.1/lib/python3.6/site-packages (2.3)

Now on this machine I have two python versions managed with pyenv. Current is 3.6.1 and the default system one is 3.7. Wonder if IPython/Hydrogen are getting “confused” …

and the same happens if I try !pip3 install treetaggerwrapper from Atom/Hydrogen

I don’t have Mac but can’t you switch Py versions ?

1 Like

YAY !!! Thanks to your perseverance and patience we have a solution :slight_smile:

I used pyenv to switch back. to the system default global python version 3.7.1

Tried running the program command line and it did not find the library.

Used the pip3 command to install it globally for 3.7.1

Now program runs also in ATOM/Hydrogen

So it seems that even though Hydrogen did seem to use the pyenv 3.6.1 python interpreter (as testified by Python -V from the terminal within Atom), it pointed to the default system 3.7.1 libraries …

Can this be cleaned up/fixed?

Thanks a lot !!!