pyGPs code problem - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: pyGPs code problem (/thread-30347.html) |
pyGPs code problem - pygauss10 - Oct-16-2020 (**English is not my native language; please excuse typing errors.) I just installed a site package pyGPs(via 'pip install pyGPs', you can also download from https://github.com/marionmari/pyGPs), and after I try to run to ensure that it was correctly installed, Some problems occured: 'pyGPs\__init__' and 'pyGPs\Core\__init__' these two files said that the errors are from each other, and file 'pyGPs\Core\gp' can not run either. I try to find and search through Google but I cant found what is wrong with them: pyGPs\__init__: from __future__ import absolute_import import Optimization import Validation import GraphExtensions from Core import * from Core.gp import * __all__ = ['Optimization', 'Validation', 'GraphExtensions', 'Core'] pyGPs\Core\__init__:from __future__ import absolute_import import inf import cov import mean import lik import gp import opt __all__ = ['inf', 'cov', 'mean', 'lik','gp','opt'] pyGPs\Core\gp:... import itertools import numpy as np import matplotlib.pyplot as plt import inf, mean, lik, cov, opt from tools import unique, jitchol, solve_chol from copy import deepcopy import pyGPs from pyGPs.Core.cov import FITCOfKernel ... The first two errors said that no module named 'gp', but there is a module name gp; and the third error said that no module named 'Core', still there is a module name Core. So I wonder what are they talking about, should I reinstall them or there is something I miss in my site package? My objective is to run the file without error(my python version is 3.8.3) RE: pyGPs code problem - bowlofred - Oct-16-2020 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") If that works okay, you should be able to call the pyGPs functions from within your script.
RE: pyGPs code problem - bowlofred - Oct-16-2020 I see some differences between the behavior of the package and the documentation. I wonder if the code has undergone some updates and the documentation hasn't kept up? One of the examples suggests that this should work: import pyGPs import numpy as np model = pyGPs.GPR() # specify model (GP regression)But it doesn't. I was able to get it to work (and the demo to draw data) by making the following modifications: import pyGPs import pyGPs.Core.gp import numpy as np model = pyGPs.Core.gp.GPR() # specify model (GP regression) RE: pyGPs code problem - pygauss10 - Oct-17-2020 (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. I try to do what you said, and I found some strange things: import pyGPs print("import successful")and it shows 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 I go check the error placefrom __future__ import absolute_import import scg import minimize import confbut 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 Then I run the script 'valid':from __future__ import absolute_import import validthe 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 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? RE: pyGPs code problem - pygauss10 - Oct-17-2020 (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.I just reinstall pyGPs agian and test it and I can import pyGPs right now. Then I remember I changed some script inside pyGPs in order to make them run independently(which means nothing), that may be the reason that the errors occur. Bowlofred I thank for your help. RE: pyGPs code problem - pygauss10 - Oct-17-2020 (Oct-16-2020, 08:14 PM)bowlofred Wrote: I see some differences between the behavior of the package and the documentation. I wonder if the code has undergone some updates and the documentation hasn't kept up?I have the same thought, the documentation might not be updated for a long time so that some of the demo scripts can run, but some can't. They just have to be changed manually. |