AequilibraE / qaequilibrae

Free QGIS add-on for transportation modeling
https://www.aequilibrae.com/qgis/latest/
Other
75 stars 24 forks source link

Switch installation of extra packages to user's folder #196

Closed pedrocamargo closed 1 year ago

pedrocamargo commented 2 years ago

Installing extra packages for OMX support and Routing has proven to be an issue for many users, as that requires administrator privileges, and doing it without often breaks QGIS and/or AequilibraE.

Looking at a user's path (on Windows), we see the following.

C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\AequilibraE-GUI\aequilibrae C:/PROGRA~1/QGIS32~2.1/apps/qgis/./python C:/Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS32~2.1/apps/qgis/./python/plugins C:\Program Files\QGIS 3.26.1\bin\python39.zip C:\PROGRA~1\QGIS32~2.1\apps\Python39\DLLs C:\PROGRA~1\QGIS32~2.1\apps\Python39\lib C:\Program Files\QGIS 3.26.1\bin C:\Users\USER\AppData\Roaming\Python\Python39\site-packages C:\PROGRA~1\QGIS32~2.1\apps\Python39 C:\PROGRA~1\QGIS32~2.1\apps\Python39\lib\site-packages C:\PROGRA~1\QGIS32~2.1\apps\Python39\lib\site-packages\win32 C:\PROGRA~1\QGIS32~2.1\apps\Python39\lib\site-packages\win32\lib C:\PROGRA~1\QGIS32~2.1\apps\Python39\lib\site-packages\Pythonwin C:/Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\go2streetview C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\go2streetview\res

Can't we install those packages in one of the paths highlighted in bold (or in the AequilibraE-GUI folder under a subdirectory)? Local tests suggest we can, so applying the change would be terrific.

In case we can, it would be ideal to have the AequilibraE library changed to an external package as well, which would automatically install the required version of the library without requiring the current janky workflow with the binaries.

The one issue that might make it impossible to make the AequilibraE Python package not installable through PIP is that NumPy changes the size of its C Array, which breaks compatibility for compiled code such as that in AequilibraE. Maybe releasing always 2+ versions of AequilibraE (Python) for different versions of C-arrays in NumPy?

jamiecook commented 2 years ago

We may be able to just use --user as well?

Need to be careful that we don't also install packages (esp transitive dependencies) that are already part of QGIS's python install.

pedrocamargo commented 2 years ago

Installing with "python3 -m pip install --user PACKAGE NAME" seems to be the right thing to do.

Removing the installed packages when uninstalling AequilibraE must be done carefully, only removing packages that are in the user folder --> https://stackoverflow.com/a/62167797/1480643

pedrocamargo commented 2 years ago

This would take care of https://github.com/AequilibraE/QAequilibraE/issues/194 as well

pedrocamargo commented 2 years ago

@TTalex , I have taken the first crack at it, but there seems to be an issue with Pyarrow in Windows that goes beyond my skills to solve. I tried different going down to the previous version of Pyarrow and it did not help.

jamiecook commented 2 years ago

@pedrocamargo - you're initial attempt is in https://github.com/AequilibraE/QAequilibraE/pull/204 right?

pedrocamargo commented 2 years ago

@pedrocamargo - you're initial attempt is in #204 right?

Yes!