-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editable install not working #460
Comments
Hi @OFR-IIASA - based on the output here it looks like The best way to test that everything works on a given system is to run the tests. Can you confirm if those pass or not? It would be good to confirm that the local editable installed version is the only ixmp version installed on the machine. |
Correct. Using the
with the regular install, no errors occur. |
I have now tested older versions of ixmp. This same problem applies. Maybe someone else try on hpg914? |
So, I have resolved the issue by going to the directory where ixmp is installed in the case of a non-editable installation, based on the above this would be |
@OFR-IIASA should this issue be raised in the weekly list or you think it is resolved and closed. |
Hi, had a similar issue today when trying to install ixmp as editable. Despite getting a "successfully installed" message, it was not found by message-ix and running ixmp show-versions resulted in an error as well. I tried both fixes suggested by @OFR-IIASA and both worked (individually):
Likely, this issue resulted from an earlier message-ix installation where ixmp was installed as dependency. |
Reading about editable installs, there is a direct mention of these specific variables in the 'Limitations' section:
This makes me think that we're not seeing unintended behaviour here. And indeed, Could you please check if these tests are working? |
When running |
After installing message_ix with a fresh clone via
So ixmp seems to have been detected as intended. The tests also run without errors for me. Could you please provide more detailed information about your error messages, @jansteinhauser? |
Hi, tests are working fine for me (if I ignore the 4 xfailed). show-versions also works fine. In general, my installation process leading here was:
Maybe this helps with pinpointing the issue (or if this is an issue at all) |
You can safely ignore the xfails as they are expected to fail. So it's good to hear that your issue is fixed now. Thanks also for your instructions on how to reproduce the problem. (Un-)Fortunately, I can't reproduce it. So here's what I ran:
because as you can see from my list, there is no need to explicitly uninstall one of the packages. And it shouldn't take multiple installs either, so my current best guess is that at some point in these attempts, you installed different versions of ixmp, and your python didn't know which to use/used the wrong one. Performing a fresh editable install works for me, either way, and even changing from a pip installation to 'from source' seems to work for me by following the steps I outlined above. |
Just for the record: The uninstall/install attempts started only after I got the message-ix/ixmp errors described. They were an attempt to back to a clean slate and reinstall properly, but didn't change anything for the better. As far as I can tell, the issue popped up when I had two ixmp folders installed, so after the first installation from source. So, I would agree that it's due to different versions being installed, albeit both versions individually seem to work as intended (the first one did so before I installed from source, the second one did after I removed the first one) Long story short: We can't reproduce my issue, I guess, but hopefully it's not something that'll likely happen again. Thanks for looking into it! |
Sounds good. Just for future reference, we recently dealt with a related issue where jupyter was also not using the correct version of ixmp when multiple were installed on slack. |
Today, I finally ran into the same problem! After switching from a 'normal' Through printing So, if you installed ixmp at some point and now want to switch to an editable version, the best advice would be to use a new virtual environment. If that's not an option, uninstall ixmp completely before installing as editable, checking the If you have any idea of what is causing this error (probably some interplay of pip, jupyter, and ubuntu), please let us know. |
@khaeru, this is largely for the record and for your information, it might also contain a requirement that we would want our packaging tools to satisfy. Today, @th-hara pointed me to another issue: even after following the steps as described above, fridolin@fridolin-Latitude-5520 ~> (message_ix) python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ixmp import Platform
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Platform' from 'ixmp' (unknown location)
>>> quit()
fridolin@fridolin-Latitude-5520 ~> (message_ix) cd ixmp
fridolin@fridolin-Latitude-5520 ~/ixmp (main) [1]> (message_ix) python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ixmp import Platform
>>> quit() In pip's documentation on editable installs, there is a note that the behaviour of the installs depends on the build-backend. For ixmp, this is fridolin@fridolin-Latitude-5520 ~/t/ixmp4 (main)> (test_ixmp4) python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ixmp4 import Run
>>> quit()
fridolin@fridolin-Latitude-5520 ~/t/ixmp4 (main)> (test_ixmp4) cd ..
fridolin@fridolin-Latitude-5520 ~/tmp> (test_ixmp4) python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ixmp4 import Run
>>> quit() I.e., the poetry build-backend does not seem to struggle with editable installs being called from outside the package's directory. We would have to try if the same holds for pdm. |
Up until recently, the editable install worked fine.
Using the latest ixmp version, the editable installation can be executed and installed, but the ixmp module cannot be used from other directories, except the installation directory.
Code sample or context
The code snippet shows the difference of trying to import ixmp in python when it is installed via
pip install .
followed bypip install -e .
-->
Expected result
upon installing ixmp via
pip install -e .
, it should be possible to import the package in python.Problem description
None
is returned upon import.Versions
The text was updated successfully, but these errors were encountered: