fix pip install: remove autosave.math & add version
EtienneDesticourt opened this issue · comments
Hiya,
After installing and launching mathinspector I get:
Traceback (most recent call last):
File "/***/venv/lib/python3.8/site-packages/mathinspector/project.py", line 282, in load
self.app.menu.import_module(i["name"], i["alias"])
File "/***/venv/lib/python3.8/site-packages/mathinspector/mainmenu.py", line 276, in import_module
self.app.modules[alias or module] = __import__(module)
ModuleNotFoundError: No module named 'tqdm'
in the mathinspector shell.
The issue is resolved by installing tqdm using pip so I think it's probably just missing from your requirements.
Cheers
The error message you are seeing indicates that mathinspector is trying to import tqdm
into the workspace because it is in the autosave file. Whoops! Thanks for reporting this.
I am working on fixing this, and need to dig into the deploy process to figure out how to prevent the autosave file from being pushed like this again, and it should hopefully be live within 0-2 days.
tqdm is not actually a requirement for mathinspector, but we have been testing that package to make sure it works properly in mathinspector. We just did a massive update to support pip install
and I think during that process the autosave file got edited somehow.
Ah I assume you packaged the *.math
file in a release accidentally? It's not included in pip
releases but I guess pyinstaller picks it up for the exe/dmg releases
Ah I assume you packaged the *.math file in a release accidentally?
That's what I am trying to figure out. autosave.math is in the assets/ dir. It's also in .gitignore. I don't think I put it in the release accidentally. If I had, it would be on the master branch, but there is no autosave.math in the master branch.
I have been unable to reproduce the issue yet because the way autosave works with LOCALAPPDATA has various scenario's and I am still working through them to try and reproduce it.
File "/***/venv/lib/python3.8/site-packages/mathinspector/project.py", line 282, in load
This error message indicates this was installed via pip install
not pyinstaller
. Just to be sure I downloaded the pyinstaller mac app and it is using the LOCALAPPDATA autosave file and there was no tqdm
error (I uninstalled tqdm to try and reproduce the issue)
well that's an issue with how autosave.math
works then.
- run
pip install mathinspector some_other_package
- run
mathinspector
- add to autosave:
>>> import some_other_package
pip uninstall some_other_package
- autosave is now broken
I guess mathinspector
should try: import ...; except ImportError: pass
when loading?
@MathInspector Sorry for the meta-comment but I'm encountering quite a few issues with the package from the get-go (node linking, node selection, using numpy built-ins, ...). Is it useful to you if I open an issue for each of them or should I wait for the package to mature a little? I don't want to spam the repo.
@EtienneDesticourt no worries! Please open all of them, that is very helpful. This project is in active development and I am planning to work on it a lot today and this week.
There is no feature backlog, and the main focus I have is on reaching a high level of stability, and so opening these issues would be extremely helpful. Thanks!
Personally I'd prefer one issue per, well, issue too.
I think a good solution here is to gracefully handle any errors in the autosave file like you suggest @casperdcl
I would still like to figure out how this happened in the first place.
@EtienneDesticourt Is it correct that when you saw this error, it was immediately after running pip install
, and that the app did not launch when you ran the mathinspector
command for the first time?
If that is the case, I would like to figure out how that happened to make sure no one else experiences similar issues in future releases.
More specifically it's about pip install
on a "clean" system. If it was installed before then there could have been an old autosave.math
file in LOCALAPPDATA already.
@casperdcl would it make sense to put autosave.math
in a directory called mathinspector
in LOCALAPPDATA?
In util.py
it's doing that for windows but not other plaforms
https://github.com/MathInspector/MathInspector/blob/master/mathinspector/util/config.py#L33
It was my first install of mathinspector and it was installed through pip in a new virtual environment. (I'm on linux using python 3.8)
mathinspector did launch, it just showed the error at the start of the mathinspector console.
would it make sense to put
autosave.math
in a directory calledmathinspector
in LOCALAPPDATA?
I would firstly say yes, subfolder, and secondly maybe even sub-subfolder based on detected virtualenv name.
mathinspector did launch, it just showed the error at the start of the mathinspector console.
When mathinspector tries to open a .math file, it will log any error messages which result from loading that file into the console. In this case, the problem was there was an autosave file included in pip install
somehow.
There are many reasons why a .math file could fail to load, and a desirable feature would be to log these errors to the in-app console. In this case, mathinspector didn't fail to load, but it gave a very confusing error message.
My strong preference is to continue to display error messages in the in-app console when a save file fails to load.
well that's an issue with how autosave.math works then.
I think its more clear for the users who uninstall a module used by autosave, to have an error message displayed, and just not have the app silently fail to import that module and then have other things in the project break as a result. I have done my best to avoid a large number of nightmare scenario's associated with backwards compatibility with autosave files, but there is a lot that might go wrong in the future so imo it's important to keep logging error messages for failed autosave loads.
yes but at least cleanup the message. One line, not 5, per import error.