visionscript icon indicating copy to clipboard operation
visionscript copied to clipboard

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

Open VedantMadane opened this issue 2 years ago • 8 comments
trafficstars

Search before asking

  • [X] I have searched the VisionScript issues and found no similar bug report.

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

  • VisionScript:
  • OS: Windows
  • Python 3.8

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)

VedantMadane avatar Aug 22 '23 11:08 VedantMadane

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

oceanthrsty avatar Aug 22 '23 13:08 oceanthrsty

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 avatar Aug 22 '23 13:08 capjamesg

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 avatar Aug 24 '23 21:08 capjamesg

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

capjamesg avatar Aug 24 '23 21:08 capjamesg

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.

AndyPermaRobotics avatar Aug 25 '23 11:08 AndyPermaRobotics

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.

capjamesg avatar Aug 25 '23 11:08 capjamesg

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

ad-si avatar Jan 04 '24 12:01 ad-si

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.

haydenflinner avatar Jan 14 '24 14:01 haydenflinner