Embarcadero/PythonEnvironments

LocalEnvironment Setup?

peardox opened this issue · 11 comments

It appears I need to provide a path for LocalEnvironment but giving it the root of the System Python causes a FileNotFound triggering an exception. Tried on Windows in advance of Mac but couldn't get Windows to work so stuck...

image

Tried this using an extremely simple test project with AutoLoad enabled as this works on Win64 via EmbeddedEnvironment

Also - the Addons - are these required for Win/Mac/Linux? If so which ones (what do they do out of interest)

You need to share further details. How have you set the "FilePath" property?

It is always good if you provide good explanation along your issue and a minimalist sample to reproduce.

Oh, thought I included that info (obviously not)

Yes, I set the path to ...
C:\Users\simon\AppData\Local\Programs\Python\Python39 which has a full 3.9.12 with Pip in it

See....

image

I keep providing sample repos but you never look at them :)

Here's one for this, it's currently using embedded 3.9.12 - https://github.com/peardox/SimplePython

I tried switching out PyEmbed: TPyEmbeddedResEnvironment39 to a TPyLocalEnvironment but then it complained about the path

Hmm - possibly....?

Environment = C:\Users\simon\AppData\Local\Programs\Python
PythonVersion = Python39

As there's no docs I'm aiming to write some but want to have it working on Mac + Linux as well and it looks like Mac's going to need LocalEnvironment

BTW - Tried starting writing install and basic use docs today with 11.2 - wouldn't compile Win64 - complained about x64 vs x86 (I'll try 11.1 later)

Oh - a local env won't have an activate.sh?

Haa... the FilePath is a JSON file with settings. Have a look at the PyEnironment.Local file, it has an example of the JSON structure.

When providing samples, try to reduce it to the minimal necessary code to reproduce your issue. It does it much easier to troubleshoot.

That activate.sh is only provided by our Python zip files. It is only used to setup the environment in the terminal, it is never used in our projects.

Haa... the FilePath is a JSON file with settings. Have a look at the PyEnironment.Local file, it has an example of the JSON structure.

Documentation on demand :) Cool...

I'll give that a go - just switched SimplePython to using either Embedded or Local via a $DEFINE

When providing samples, try to reduce it to the minimal necessary code to reproduce your issue. It does it much easier to troubleshoot.

It couldn't be any simpler without producing any output...

I will share docs and samples along the Python Environments project as possible. I know this is crucial and we need to give it attention. Sorry for that and thanks for your support.

The whole point of what I'm doing ATM is to create a simple and complete set of installation and basic usage documents + videos :)

Do I need a PythonVersion setting for Local?

This JSON is accepted as a valid file but nothing happens (looking into it)

[{
        "python_version": {
            "home": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python39",
            "shared_library": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python39\\python39.dll",
            "executable": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python39\\python39.exe"
        }
    }
]

Using this JSON....

[{
        "python_version": {
            "home": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python39",
            "shared_library": "python39.dll",
            "executable": "python.exe"
        }
    }
]

And setting PythonVersion to 3.9 results in the version not being found in PYTHON_KNOWN_VERSIONS[] which appears to abort setup and / or activate (tried both)

Got it!

[{
        "3.9": {
            "home": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python39",
            "shared_library": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python39\\python39.dll",
            "executable": "C:\\Users\\simon\\AppData\\Local\\Programs\\Python\\Python39\\python.exe"
        }
    }
]

That was far from obvious and the sample was extremely unclear...