App or Extension Does Not Exist #787
swainn
started this conversation in
Tips and Tricks
Replies: 1 comment
-
|
As a point of clarification, the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Ever install an app and end up with this confusing error message at the end:
tethys install ... The app or extension you specified ("my_first_app") does not exist. Command aborted. Successfully installed my_first_app.If so, this post is for you. This issue is usually caused by one of two things:
TLDR; Tethys 3 apps require using the native namespace packaging approach (see: Packaging namespace packages | PyPA. Please ensure all apps installed have been properly migrated. Also check to see if any import errors are occurring (run
python /path/to/manage.py shelland import various files from your app).Python Namespace Packages
This issue can arise if you have apps that mix different approaches for doing namespacing in Python. In Tethys 2, apps used to have an
__init__.pyfile in theirtethysappdirectory, but in Tethys 3 these__init__.pyfiles should be removed. If you have any previously Tethys 2 apps installed that were not properly upgraded, it could cause this issue. For more details about the process of upgrading Tethys apps see: Migrating Apps from Tethys 2.To complicate matters, some IDEs (i.e. PyCharm) have been known to automatically add
__init__.pyfiles to thetethysappdirectory. So it is possible that the file got added to your new app without you being aware of it.Another aspect of this issue that makes it confusing is that having the old Tethys 2 apps installed does not necessarily mean they won't work. If all the apps that are installed use the same namespacing method, they will be loaded. But as soon as you install an app that uses a different namespacing pattern, Python will choose one or the other to use and ignore apps that don't use the method it picked. Python seems to pick the namespace pattern it encounters first, which means sometimes only the Tethys 2 style apps will load, and sometimes only the Tethys 3 style apps will load, depending on which app it loads first.
For a good primer on Python namespace packages see: Packaging namespace packages | PyPA.
Note
Although apps with the Tethys 2 style of namespace packaging can technically work in Tethys 3, it is not recommended. As soon as a Tethys 3 style app is installed this confusing issue will be encountered.
Import Errors
The other thing that can cause this issue is if there is an import error occurring when Tethys tries to import files from the app. This can be caused by a missing dependency or a syntax error in one of the files. The easiest way to debug this issue is to open a Django shell and try importing various files from the app (
python /path/to/manage.py shell). The controllers.py file(s) tend to be the culprits when this happens.Beta Was this translation helpful? Give feedback.
All reactions