patlevin / tfjs-to-tf

A TensorFlow.js Graph Model Converter
MIT License
139 stars 18 forks source link

AttributeError: module 'tfjs_graph_converter' has no attribute 'api' #12

Closed DA-fromindia closed 4 years ago

DA-fromindia commented 4 years ago

why package is not able to get this file??

patlevin commented 4 years ago

I need a little more context than that. Did you install via pip? Which OS and which python version are you using? Did the error happen when using the command-line tool or in a script you wrote?

DA-fromindia commented 4 years ago

I solved the error by manually changing a path! I am using Windows, Python3.7 and error was happened in Pycharm!!

patlevin commented 4 years ago

Great to hear that you were able to solve the issue 👍

bjajoh commented 4 years ago

I'm in windows and have the same issue, how did you solve it?

patlevin commented 4 years ago

@bjajoh If you are using pycharm as well, the problem might be due to a path conflict from using conda+pip. With pycharm installing via the IDE's virtual environment (e.g. using a Pipfile) might solve this. Since I don't use pycharm, this is just a guess, however.

bjajoh commented 4 years ago

@patlevin I'm not using pycharmjust plain vscode a text editor. Might this be a general windows issue?

patlevin commented 4 years ago

@bjajoh The issue might be that the debugger doesn't honour the conda environment and uses \Anaconda3\python.exe as interpreter instead of \Anaconda3\{YOUR-ENV}\python.exe. This can be changed by opening the settings.json in the workspace folder and replacing python.pythonPath with the interpreter of your conda environment.

Alternatively you can set the python.venvPath in your vscode user settings to ~\Anaconda3\envs, which will allow you to select the correct Python virtual environment directly from the UI (which is what I did and thus never had this problem).

patlevin commented 4 years ago

@bjajoh It just occurred to me that you might have a different issue entirely. "api" is not a sub-package within the "tfjs_graph_converter"-module. This means you cannot import it like so:

import tfjs_graph_converter as t

t.api.load_graph_model(...) # <- this won't work!

The correct usage would be

import tfjs_graph_converter.api as api
# from tfjs_graph_converter import api  <- this also works as intended

api.load_graph_model(...)
DA-fromindia commented 4 years ago

@bjajoh It just occurred to me that you might have a different issue entirely. "api" is not a sub-package within the "tfjs_graph_converter"-module. This means you cannot import it like so:

import tfjs_graph_converter as t

t.api.load_graph_model(...) # <- this won't work!

The correct usage would be

import tfjs_graph_converter.api as api
# from tfjs_graph_converter import api  <- this also works as intended

api.load_graph_model(...)

This is what i did! and solved that error!!

@bjajoh alternatively, i found one more solution , i was using posenet that time, so i change their "IMPORT" in a proper way!

patlevin commented 4 years ago

I decided to treat this issue as a bug and will fix this in the next version.

bjajoh commented 4 years ago

Thanks!