capjamesg / visionscript

A high-level programming language for using computer vision.
https://visionscript.dev/
MIT License
342 stars 19 forks source link

There is no reference.json file created after running `pip install visionscript` #6

Open VedantMadane opened 1 year ago

VedantMadane commented 1 year ago

Search before asking

What is the issue?

reference.json file was not created in site-packages after running pip install visionscript. So I cloned the repo in another folder, copied the reference.json file into site-packages/visioncript. Until then writing visionscript in the command line terminal produced following error:

  File "c:\users\vedantm\appdata\local\programs\python\python38\lib\site-packages\visionscript\usage.py", line 4, in <module>
    with open(os.path.join(os.path.dirname(__file__), "reference.json")) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'c:\\users\\vedantm\\appdata\\local\\programs\\python\\python38\\lib\\site-packages\\visionscript\\reference.json'

Environment

How can we replicate the bug?

pip install visionscript visionscript

Additional

Additionally, after running visionscript --notebook notebook fails to start: image vedantm@vedantm MINGW64 /d/Projects/misc/visionscript (main) $ visionscript --notebook Starting notebook... Traceback (most recent call last): File "c:\users\vedantm\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\vedantm\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\vedantm\AppData\Local\Programs\Python\Python38\Scripts\visionscript.exe__main.py", line 7, in File "c:\users\vedantm\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1157, in call return self.main(*args, kwargs) File "c:\users\vedantm\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) File "c:\users\vedantm\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "c:\users\vedantm\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 783, in invoke return callback(*args, **kwargs) File "c:\users\vedantm\appdata\local\programs\python\python38\lib\site-packages\visionscript\lang.py", line 2804, in main from visionscript.notebook import app File "c:\users\vedantm\appdata\local\programs\python\python38\lib\site-packages\visionscript\notebook.py", line 12, in
import qrcode ModuleNotFoundError: No module named 'qrcode' (base)

The reason given is qrcode module not found. But when installing qrcode, the requirement is already satisfied: image $ pip install qrcode Requirement already satisfied: qrcode in d:\anaconda\lib\site-packages (7.4.2) Requirement already satisfied: typing-extensions in d:\anaconda\lib\site-packages (from qrcode) (4.6.3) Requirement already satisfied: pypng in d:\anaconda\lib\site-packages (from qrcode) (0.20220715.0) Requirement already satisfied: colorama in d:\anaconda\lib\site-packages (from qrcode) (0.4.6) (base)

oceanthrsty commented 1 year ago

I had the same exact issue, and I did exactly what you did.

First I did a pip install visionscript and ran into the same issues.
So I cloned the repo, got the reference.json and copied it into my site-packages.

Re-ran it, got the missing qrcode module. But after installing, I was able to get past that point.
Then I got a message saying flask was missing, installed that. Then I got pygtrie was missing Then I got a message saying it needed cryptography library, installed that and finally was able to run visionscript --notebook.

However now I see:

raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: notebook.html

So I decided to just install the cloned repo.. and now I am up and running. Need to add the following modules to the requirements.txt:

watchdog
qrcode
flask
cryptography
pygtrie
capjamesg commented 1 year ago

Thank you for the report; it is greatly appreciated! I will push a new version with the requisite dependencies. I also have to get CLIP installed as a post-setup dependency; CLIP not having a pip package makes the installation thereof more convoluted. I haven't seen the notebook error! Let me investigate.

capjamesg commented 1 year ago

I have just pushed visionscript==0.0.7 which includes fixes for the dependencies (including CLIP), and the missing JSON file. On my TODO list are to finish the FastSAM installation process (used by Segment[]), and to figure out why notebook.html isn't showing up properly.

capjamesg commented 1 year ago

@oceanthrsty Your listing out the dependencies that weren't installed was so helpful -- thank you!

AndyPermaRobotics commented 1 year ago

Hi, I am new to visionscript and tried the install tutorial:

$> pip install visionscript

program.vic:
codeLoad["./image.jpg"]
Detect["person"]
Show[]

$> visionscript program.vic

I installed version 0.0.7, but I still got the missing reference.json error. As well as a ModuleNotFoundError: No module named 'roboflow' error.

capjamesg commented 1 year ago

Ah one more! I just added that dependency in the latest version to power https://visionscript.dev/roboflow/. I'll add that dependency and distribute a new version on PyPi.

ad-si commented 9 months ago

I'm still getting the No module named 'roboflow' error. Did you already upload the new version to PyPi @capjamesg?

haydenflinner commented 9 months ago

Given the current version on pip, this would be enough to get a notebook started.

pip install roboflow
sp=$(python -c 'import networkx; from pathlib import Path; print(Path(networkx.__file__).parent.parent)')
cd $sp/visionscript
wget https://raw.githubusercontent.com/capjamesg/visionscript/main/visionscript/reference.json
cd -

But there are two issues. First, the notebook hosts on all interfaces rather than just localhost. This is an insecure default. Second, I get this err: TemplateNotFound jinja2.exceptions.TemplateNotFound: notebook.html.

So it seems like static files in general are not being included in the pip package. You can test this install flow locally with pyenv (virtual envs) and using true pip install rather than pip install -e.