def setup(compiled_modules=True): julia.install() jl = Julia(compiled_modules=compiled_modules) from julia import Pkg Pkg.add("[email protected]") # Lock to specific version for stability Pkg.add("Distributions") # Install Distributions after Bigsimr
def install( julia_download_path='https://julialang-s3.julialang.org/bin/linux/x64/1.4/julia-1.4.0-linux-x86_64.tar.gz', julia_target_path=None): ''' :param julia_download_path: Path for the julia download, you can modify for your preferred version :param julia_target_path: Specify where to install Julia, if not specified will install in $HOME$/julia ''' if julia_target_path == None: julia_target_path = os.path.join(os.path.expanduser("~"), 'julia') if not os.path.isdir(julia_target_path): os.mkdir(julia_target_path) download_path = os.path.join(julia_target_path, 'julia_install.tar.gz') print("Downloading Julia:") wget.download(julia_download_path, download_path) print("\nExtracting...") tar = tarfile.open(download_path, "r:gz") tar.extractall(julia_target_path) _, partial_path = get_julia_path_from_dir(julia_target_path) os.environ["PATH"] += os.pathsep + partial_path os.system("echo '# added by dpmmpython' >> ~/.bashrc") os.system("echo 'export PATH=\"" + partial_path + ":$PATH\"' >> ~/.bashrc") print("Configuring PyJulia") julia.install() julia.Julia(compiled_modules=False) print("Adding DPMMSubClusters package") from julia import Pkg Pkg.add("DPMMSubClusters") print( "Please exit the shell and restart, before attempting to use the package" )
def test_pandamodels_dev_mode(): from julia import Main from julia import Pkg from julia import Base if Base.find_package("PandaModels"): # remove PandaModels to reinstall it Pkg.rm("PandaModels") Pkg.resolve() Pkg.Registry.update() Pkg.add("PandaModels") print("installing dev mode is a slow process!") Pkg.resolve() Pkg.develop("PandaModels") # add pandamodels dependencies: slow process Pkg.instantiate() Pkg.build() Pkg.resolve() print("dev mode of PandaModels is added to julia packages") try: Pkg.activate("PandaModels") Main.using("PandaModels") print("using PandaModels in its dev mode!") except ImportError: # assert False raise ImportError("cannot use PandaModels in its dev mode") # activate julia base mode Pkg.activate() Pkg.free("PandaModels") Pkg.resolve()
def test_pandamodels_installation(): from julia import Main from julia import Pkg from julia import Base if Base.find_package("PandaModels"): # remove PandaModels to reinstall it Pkg.rm("PandaModels") Pkg.resolve() else: print("PandaModels is not installed yet!") Pkg.Registry.update() Pkg.add("PandaModels") Pkg.build() Pkg.resolve() print("PandaModels is added to julia packages") try: Main.using("PandaModels") print("using PandaModels in its base mode!") except ImportError: raise ImportError("cannot use PandaModels in its base mode")
def install_julia_dependencies(): """ Install Julia packages required for quickpomdps """ from julia import Pkg Pkg.add(["PyCall","QuickPOMDPs"])
def _call_pandamodels(buffer_file, julia_file, dev_mode): # pragma: no cover try: import julia from julia import Main from julia import Pkg from julia import Base except ImportError: raise ImportError( "Please install pyjulia properly to run pandapower with PandaModels.jl." ) try: julia.Julia() except: raise UserWarning( "Could not connect to julia, please check that Julia is installed and pyjulia is correctly configured" ) if not Base.find_package("PandaModels"): logger.info( "PandaModels.jl is not installed in julia. It is added now!") Pkg.Registry.update() Pkg.add("PandaModels") if dev_mode: logger.info("installing dev mode is a slow process!") Pkg.resolve() Pkg.develop("PandaModels") # add pandamodels dependencies: slow process Pkg.instantiate() Pkg.build() Pkg.resolve() logger.info("Successfully added PandaModels") if dev_mode: Pkg.develop("PandaModels") Pkg.build() Pkg.resolve() Pkg.activate("PandaModels") try: Main.using("PandaModels") except ImportError: raise ImportError("cannot use PandaModels") Main.buffer_file = buffer_file result_pm = Main.eval(julia_file + "(buffer_file)") # if dev_mode: # Pkg.activate() # Pkg.free("PandaModels") # Pkg.resolve() return result_pm
import julia julia.install() from julia import Pkg Pkg.add('QXZoo') import pyqx.qxzoo
try: import julia except ImportError: print("Julia is not installed!") try: from julia import Lathe except: from julia import Pkg Pkg.add("Lathe")
__maintainer__ = 'Glaucon Garcia' __email__ = '*****@*****.**' __status__ = 'Development' if __name__ == '__main__': setup(name=__title__, version=__version__, url=__url__, description=__description__, long_description=__description__, author=__author__, author_email=__email__, license=__license__, keywords=__keywords__, packages=find_packages(), include_package_data=True, install_requires=[ 'julia', ], classifiers=[ 'Development Status :: 1 - Development', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'Operating System :: OS Independent', 'Programming Language :: Python :: 3', 'Topic :: Utilities' ]) julia.install() Pkg.add("JSON") Pkg.add("JuMP")
# The Light-Dark problem from https://arxiv.org/pdf/1709.06196.pdf from quickpomdps import QuickPOMDP from julia import Pkg Pkg.add(["POMDPs", "POMDPSimulators", "POMDPPolicies", "POMDPModelTools", "Distributions", "QMDP"]) from julia.Main import Float64 from julia.POMDPs import solve, pdf from julia.QMDP import QMDPSolver from julia.POMDPSimulators import stepthrough from julia.POMDPPolicies import alphavectors from julia.POMDPModelTools import Uniform, Deterministic from julia.Distributions import Normal r = 60 light_loc = 10 def transition(s, a): if a == 0: return Deterministic(r+1) else: return Deterministic(min(max(s+a, -r), r)) def observation(s, a, sp): return Normal(sp, abs(sp - light_loc) + 0.0001) def reward(s, a, sp): if a == 0: return 100.0 if s == 0 else -100.0 else: return -1.0
# Configure PyJulia import julia julia.install() # install PyCall.jl etc. # Add the Tempotrons.jl package from julia import Pkg Pkg.add(url = "https://github.com/bci4cpl/Tempotrons.jl")