Error occured when import physo: "Can not import display packages"
freemank1224 opened this issue · 12 comments
`(physo) freeman@FreemanWorkStation:~/PhySO$ python3
Python 3.8.0 (default, Nov 6 2019, 21:49:08)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
import physo
/home/freeman/PhySO/physo/physym/program.py:20: UserWarning: Can not import display packages.
warnings.warn("Can not import display packages.")
`
I used the latest version of pytorch 2.0 & cudatookit 11.7 , all depend packages were successfully installed, so how to fix this ? Thank you !
Hi freemank1224,
The code fails to import the exotic optional packages that are used for advanced debugging in tree representation.
If you are not planning on contributing code on this repo and on advanced features you don't need those so you can ignore this warning.
However, if you want to try to install those, I suggest you pull the latest version where I have made the installation of these optional packages easier via:
git pull
And then try installing these packages again via:
conda install --file requirements_display1.txt
pip install -r requirements_display2.txt
Please tell me if this fixes your issue ! :)
Wassim
Thanks for your reply. Yes I ignore it and proceed to test code, but other error messages prompt out. It seems that my torch can't be import. I'm trying to fix this issue and will give a feedback. Thanks!
You can copy paste your error and I will gladly try to help you with that if you want !
I you are having trouble installing torch, please note that you don't necessarily need the CUDA version of pytorch as it tends to even run slower on GPU than on CPU.
You can install it manually via:
conda install pytorch
And then re-run installation via:
conda install --file requirements.txt
Wassim
Thanks for your help Wassim. After updated to the latest version, there are still some errors. Here's my error message:
................/home/freeman/PhySO/physo/physym/library.py:245: UserWarning: The units of token y were not provided (is_constraining_phy_units=False ; phy_units=[nan nan nan nan nan nan nan]), unable to compute units constraints.
warnings.warn("The units of token %s were not provided (is_constraining_phy_units=%s ; phy_units=%s), "
/home/freeman/PhySO/physo/physym/library.py:245: UserWarning: The units of token x1 were not provided (is_constraining_phy_units=False ; phy_units=[nan nan nan nan nan nan nan]), unable to compute units constraints.
warnings.warn("The units of token %s were not provided (is_constraining_phy_units=%s ; phy_units=%s), "
/home/freeman/PhySO/physo/physym/library.py:245: UserWarning: The units of token pi were not provided (is_constraining_phy_units=False ; phy_units=[nan nan nan nan nan nan nan]), unable to compute units constraints.
warnings.warn("The units of token %s were not provided (is_constraining_phy_units=%s ; phy_units=%s), "
.......................get_infix_sympy time = 1.186 ms
get_infix_str time = 0.027 ms
FF
Reward_SquashedNRMSE time = 0.090 ms
................
FAIL: test_infix_repr (physo.physym.tests.program_display_UnitTest.DisplayTest)
Traceback (most recent call last):
File "/home/freeman/miniconda3/envs/physo/lib/python3.8/site-packages/matplotlib/texmanager.py", line 304, in _run_checked_subprocess
report = subprocess.check_output(command,
FileNotFoundError: [Errno 2] 没有那个文件或目录: 'latex'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/freeman/PhySO/physo/physym/tests/program_display_UnitTest.py", line 104, in test_infix_repr
img = my_programs.get_infix_image(prog_idx=0,)
RuntimeError: Failed to process string with tex because latex could not be found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/freeman/PhySO/physo/physym/tests/program_display_UnitTest.py", line 108, in test_infix_repr
self.fail("Infix generation failed : get_infix_image")
AssertionError: Infix generation failed : get_infix_image
======================================================================
FAIL: test_tree_rpr (physo.physym.tests.program_display_UnitTest.DisplayTest)
Traceback (most recent call last):
File "/home/freeman/PhySO/physo/physym/tests/program_display_UnitTest.py", line 153, in test_tree_rpr
tree_latex = my_programs.get_tree_latex(prog_idx=0,)
FileNotFoundError: [Errno 2] 没有那个文件或目录: '/tmp/dot2texnrubl895/dot2tex.log'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/freeman/PhySO/physo/physym/tests/program_display_UnitTest.py", line 157, in test_tree_rpr
self.fail("Tree generation failed : get_tree_latex")
AssertionError: Tree generation failed : get_tree_latex
Ran 70 tests in 35.520s
BTW, I have successfully imported physo in python after I installed ALL the requirements. But still have those errors when running unittest.
I meet this problem too in windows.
FAIL: test_tree_rpr (physo.physym.tests.program_display_UnitTest.DisplayTest)
Traceback (most recent call last):
File "E:\sy\code\PhySO-main\PhySO-main\physo\physym\tests\program_display_UnitTest.py", line 153, in test_tree_rpr
tree_latex = my_programs.get_tree_latex(prog_idx=0,)
NameError: name 'pgv' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\sy\code\PhySO-main\PhySO-main\physo\physym\tests\program_display_UnitTest.py", line 157, in test_tree_rpr
self.fail("Tree generation failed : get_tree_latex")
AssertionError: Tree generation failed : get_tree_latex
Ran 70 tests in 55.104s
FAILED (failures=2)
Hi @freemank1224 and @Prevalenter,
You are running into these issues because you are running physo on windows and it was not tested on this platform.
These issues originate from physo's usage of latex.
physo will be adapted to windows at some point if it does not require significant rewrite.
In the meantime you can checkout the solution proposed in #8
Thanks for your help Wassim. After updated to the latest version, there are still some errors. Here's my error message:
...........
packages/matplotlib/texmanager.py", line 304, in _run_checked_subprocess report = subprocess.check_output(command, FileNotFoundError: [Errno 2] 没有那个文件或目录: 'latex'
............
Ran 70 tests in 35.520s
Recommend install MikTex on Windows。See Installing Latex for more information
I meet this problem too in windows.
FAIL: test_tree_rpr (physo.physym.tests.program_display_UnitTest.DisplayTest)
Traceback (most recent call last): File "E:\sy\code\PhySO-main\PhySO-main\physo\physym\tests\program_display_UnitTest.py", line 153, in test_tree_rpr tree_latex = my_programs.get_tree_latex(prog_idx=0,) NameError: name 'pgv' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "E:\sy\code\PhySO-main\PhySO-main\physo\physym\tests\program_display_UnitTest.py", line 157, in test_tree_rpr self.fail("Tree generation failed : get_tree_latex") AssertionError: Tree generation failed : get_tree_latex
Ran 70 tests in 55.104s
FAILED (failures=2)
Please try:
conda install -c anaconda pygraphviz
Hi @freemank1224 and @Prevalenter,
You are running into these issues because you are running physo on windows and it was not tested on this platform. These issues originate from physo's usage of latex.
physo will be adapted to windows at some point if it does not require significant rewrite. In the meantime you can checkout the solution proposed in #8
Thanks, but I am running physo in ubuntu 20.04. Is this version of ubuntu affect this ?
Thanks, but I am running physo in ubuntu 20.04. Is this version of ubuntu affect this ?
No, unless latex is not installed on your linux system.
@freemank1224, can you try to run the notebook in demo/demo_quick_sr.ipynb
to see if you only have this issue with the tree representation unit test or if you also encounter it during an SR task ?
Hi freemank1224,
The code fails to import the exotic optional packages that are used for advanced debugging in tree representation. If you are not planning on contributing code on this repo and on advanced features you don't need those so you can ignore this warning.
However, if you want to try to install those, I suggest you pull the latest version where I have made the installation of these optional packages easier via:
git pull
And then try installing these packages again via:
conda install --file requirements_display1.txt
pip install -r requirements_display2.txt
Please tell me if this fixes your issue ! :) Wassim
hi, this way also actually fixed my same issue, and thanks a lot!