Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pyGPs code problem
#4
(Oct-16-2020, 07:38 PM)bowlofred Wrote: It is unclear what exactly you are running after doing the install. You should not be trying to run those files directly, but should be importing pyGPs into your script.

As an example, this file should run without error.

import pyGPs
print("import successful")
Output:
$ python test.py import successful
If that works okay, you should be able to call the pyGPs functions from within your script.

I try to do what you said, and I found some strange things:
import pyGPs
print("import successful")
and it shows
Error:
Traceback (most recent call last): File "C:\Users\elatm\.spyder-py3\temp.py", line 9, in <module> import pyGPs File "C:\Users\elatm\anaconda3\lib\site-packages\pyGPs\__init__.py", line 2, in <module> import Optimization ModuleNotFoundError: No module named 'Optimization'
So I check the place where it is wrong:
from __future__ import absolute_import
import Optimization
import Validation
import GraphExtensions
from Core import *
from Core.gp import *

__all__ = ['Optimization', 'Validation', 'GraphExtensions', 'Core']
and the error is
Error:
Traceback (most recent call last): File "C:\Users\elatm\anaconda3\lib\site-packages\pyGPs\__init__.py", line 2, in <module> import Optimization File "C:\Users\elatm\anaconda3\lib\site-packages\pyGPs\Optimization\__init__.py", line 2, in <module> import scg ModuleNotFoundError: No module named 'scg'
I go check the error place
from __future__ import absolute_import
import scg
import minimize
import conf
but it turns out that the script above is correct(no error)
When I go back to the first script, same error occur again, and the error occur in the second script changes
the second script:
from __future__ import absolute_import
import Optimization
import Validation
import GraphExtensions
from Core import *
from Core.gp import *

__all__ = ['Optimization', 'Validation', 'GraphExtensions', 'Core']
the error changes to
Error:
Traceback (most recent call last): File "C:\Users\elatm\anaconda3\lib\site-packages\pyGPs\__init__.py", line 3, in <module> import Validation File "C:\Users\elatm\anaconda3\lib\site-packages\pyGPs\Validation\__init__.py", line 2, in <module> import valid ModuleNotFoundError: No module named 'valid'
Then I run the script 'valid':
from __future__ import absolute_import
import valid
the script is correct, and all of these become an error cycle: go back to first script, encounter error in first script, check second script(another error occur), run file(the file runs without error),go back to first script again...
It will finally output successfully
Output:
import successful
but it requires lots of 'fixing', and can't run with the only script open:
import pyGPs
print("import successful")
I can't import pyGPs without having to open all the other files, is this a normal situation? If not, does the version matters or the installation isn't correct?
Reply


Messages In This Thread
pyGPs code problem - by pygauss10 - Oct-16-2020, 07:26 PM
RE: pyGPs code problem - by bowlofred - Oct-16-2020, 07:38 PM
RE: pyGPs code problem - by pygauss10 - Oct-17-2020, 01:56 PM
RE: pyGPs code problem - by pygauss10 - Oct-17-2020, 03:34 PM
RE: pyGPs code problem - by bowlofred - Oct-16-2020, 08:14 PM
RE: pyGPs code problem - by pygauss10 - Oct-17-2020, 03:40 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020