Closed AvisP closed 8 months ago
Hello,
Have you installed it from source ? If so, from the master branch ? Or from one of the official version (a tag like v0.7.1.post1) ?
It looks like there might be a problem with the compilation of SuiteSparse.
Have you tried to install it from pypi with pip install lightsim2grid
(or pip3 install lightsim2grid
or something similar - pip command line change name...)
Hi,
I did only a pip install lightsim2grid
while installing. The version is 0.7.1.post1 as this is what I see
Requirement already satisfied: lightsim2grid in ...../L2PRN/lib/python3.10/site-packages (0.7.0.post1)
It didn't mention anything about SuiteSparse during installing....
Hummm ok this is super weird.
I do not own a macos machine so debugging it will be hard. I will see what I can do with the script that provide the package.
On the mean time (if you are in a hurry), there are two short-term solutions :
I will try to have a look tomorrow and see what I can do.
Thanks for your prompt responses. I am using grid2ops and switched to pandapower for the time being but would like to use lightsim2grid later on for performance. I have to use a mac machine unfortunately and don't have access to windows one yet.
I will try to compile it from source by following the instructions. Please let me know if I can be of assistance in the macos debugging. Thanks
Yes indeed using pandapower for the tests sounds a good plan.
I will have a look at the scripts thag generate the files installed by pip. And maybe I'll you if you can install other file to check which works if you agree of course.
Thanks
Hi, Just to update you on this. I was able to install it from the source package and in a new virtual environment by following the custom install option of SparsSuite for macos. However there were some small issues that I resolved locally
Since in the notebooks the import is from lightsim2grid.LightSimBackend
so I capitalized the second l on this line
https://github.com/BDonnot/lightsim2grid/blob/911390a71b9a33062f0802deae39f43adce64673/lightsim2grid/__init__.py#L18
As np.bool
is deprecated I had to change it to np.bool_
on this line
https://github.com/rte-france/Grid2Op/blob/5a4c89d18406c20d39a33312b832148d7500643e/grid2op/dtypes.py#L16
Finally I had to remove np.str
on this line https://github.com/BDonnot/lightsim2grid/blob/911390a71b9a33062f0802deae39f43adce64673/lightsim2grid/securityAnalysis.py#L75
After that the following small test on using LightSimBackend worked without any issues
from lightsim2grid.LightSimBackend import LightSimBackend
from lightsim2grid_cpp import SolverType
from lightsim2grid.solver import KLUSolver
from grid2op.gym_compat import GymEnv
import grid2op
env_name = "l2rpn_case14_sandbox"
training_env = grid2op.make(env_name, test=True, backend=LightSimBackend())
gym_env = GymEnv(training_env)
Hello,
Thanks for thiq detailed procedure.
I unfortunately did not had time to have a look at this issue (nor any issue regarding lightsim2grid).
I really appreciate you spend some time to find these bugs a'd to report them.
I will update the installation on macos and see if it works after that. (I'll do it in 2023 most likely). And likewise I'll fix the python side with deprecated numpy bool and str
Thanks a lot
Benjamin
Hello,
I pushed a new version and test that it works (ie that the package once compiled can be installed and that it runs properly) can you upgrade lightsim2grid to version 0.7.1 and grid2op to version 1.8.1 and let me know if you still have this issue ?
Thanks
(there is a chance the issue is still present as I could not replicate it on any of my machines)
Hi Benjamin,
I did a test with lighsim2grid 0.7.1 and grid2op 1.8.1. I was able to successfully create a training environment with "l2rpn_case14_sandbox" case without any issues. A pip installation of lightsim2grid fails but I followed the manual instructions and that worked properly. Thanks!
Hummm weird.
Can you tell me were you got the information about the compilation of SuiteSparse ? Is there something else than "make" to do that I did not understood ?
Benjamin
I just followed the steps on the Usage section of lightsim2grid github link. The commands I used were
git submodule init
git submodule update
make
This is weird because it's exactly what is done to compile the "wheel" released on pypi :thinking:
I'll try to have another look
Hello @AvisP can you check the solution I explain here:
https://github.com/BDonnot/lightsim2grid/issues/59#issuecomment-1688261097
and tell me if it solves your issue, by any chance ?
Hi @BDonnot I created a new virtual environment with python 3.10.7 and did what was suggested with pip and got the following error message
WARNING: Requirement 'LightSim2Grid-0.7.3-cp310-cp310-macosx_11_0_arm64.whl' looks like a filename, but the file does not exist
Processing ./LightSim2Grid-0.7.3-cp310-cp310-macosx_11_0_arm64.whl
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/Users/........./LightSim2Grid-0.7.3-cp310-cp310-macosx_11_0_arm64.whl'
Can you try with simply pip install lightsim2grid
?
I made the release yesterday on pypi
So I tried with that command and installed without any errors. But then I started python and did from lightsim2grid.lightSimBackend import LightSimBackend
and got the following
from lightsim2grid.lightSimBackend import LightSimBackend
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/paula/Desktop/Projects/venvs/test_lightsim2grid/lib/python3.10/site-packages/lightsim2grid/__init__.py", line 17, in <module>
from lightsim2grid.solver import SolverType
File "/Users/paula/Desktop/Projects/venvs/test_lightsim2grid/lib/python3.10/site-packages/lightsim2grid/solver/__init__.py", line 18, in <module>
from lightsim2grid_cpp import SolverType
ImportError: dlopen(/Users/paula/Desktop/Projects/venvs/test_lightsim2grid/lib/python3.10/site-packages/lightsim2grid_cpp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_klu_analyze'
Apprently, from here https://github.com/wanadev/mozjpeg-lossless-optimization/issues/5#issuecomment-1658635511
Can you try to upgrade your python version ?
Thanks (it takes sooo long to fix this because I don't own anything using MacOS...)
Environment
latest
(eg 0.5.0)macos 12.6.1
Installation finished without any issues. However when doing
from lightsim2grid.LightSimBackend import LightSimBackend
I am getting the following error message