Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Provide older versions (3.9) of Python for VSCode on AP #4452

Closed
mshodge opened this issue Jun 4, 2024 · 9 comments
Closed

✨ Provide older versions (3.9) of Python for VSCode on AP #4452

mshodge opened this issue Jun 4, 2024 · 9 comments
Assignees

Comments

@mshodge
Copy link
Contributor

mshodge commented Jun 4, 2024

Describe the feature request.

The AP currently has Python 3.12 installed by default on the Visual Studio Code 1.3.0 install. There are many changes between this version of Python to the versions of Python on the JupyterLab installs (3.9) which means working between JupyerLabs and VS Code becomes a bit of a headache because of the severe changes to things like dsutils in Python 3.12.

Whenever I try and QA code using VS Code, I am battling version issues if the other person has written the code in JupyterLab for example.

I would be able to install Python 3.9 on VS Code using pyenv, but an easier solution to provide interoperability and encourage changeover from JupyerLabs to VS Code would be to provide the same Python version on each. For now, that would make sense to put a Python 3.9 version on VS Code I think.

Describe the context.

No response

Value / Purpose

Prevents wasted time in installing through pyenv and breakages between using JupyterLab and VS Code.

User Types

Analysts

@mshodge
Copy link
Contributor Author

mshodge commented Jun 4, 2024

Just realised I probably won't be able to install pyenv anyway as will have insufficient permissions to install Homebrew

@jacobwoffenden
Copy link
Member

jacobwoffenden commented Jun 6, 2024

deadsnakes PPA does not provide 3.9 for Ubuntu 24.04

Ubuntu 24.04 (noble) Python3.7 - Python3.11, Python3.13
...
Why some packages aren't built:

  • Note: for focal, older python versions require libssl<1.1 so they are not currently built
  • Note: for jammy and noble, older python versions requre libssl<3 so they are not currently built
  • If you need these, reach out to asottile to set up a private ppa

Source: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa

However, noble is listed here https://github.com/deadsnakes/python3.9

@jacobwoffenden
Copy link
Member

@mshodge I was able to install and use Python 3.9 with Conda on the latest (1.4.0) release of VSCode on the Analytical Platform

$ conda create -n py39 python=3.9

$ conda init

Open a new shell and then

$ conda activate py39

$ python --version
Python 3.9.19

Source: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html#installing-a-different-version-of-python

@mshodge
Copy link
Contributor Author

mshodge commented Jun 7, 2024

deadsnakes PPA does not provide 3.9 for Ubuntu 24.04

Ubuntu 24.04 (noble) Python3.7 - Python3.11, Python3.13
...
Why some packages aren't built:

  • Note: for focal, older python versions require libssl<1.1 so they are not currently built
  • Note: for jammy and noble, older python versions requre libssl<3 so they are not currently built
  • If you need these, reach out to asottile to set up a private ppa

Source: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa

However, noble is listed here https://github.com/deadsnakes/python3.9

Does that not mean they do provide 3.9 though and - Note: ... Python3.12 (noble) are not provided by deadsnakes as upstream ubuntu provides those packages.? See screenshot below too.

Screenshot 2024-06-07 at 08 58 13

@mshodge
Copy link
Contributor Author

mshodge commented Jun 7, 2024

@mshodge I was able to install and use Python 3.9 with Conda on the latest (1.4.0) release of VSCode on the Analytical Platform

$ conda create -n py39 python=3.9

$ conda init

Open a new shell and then

$ conda activate py39

$ python --version
Python 3.9.19

Source: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html#installing-a-different-version-of-python

I'll give this a try, thanks. But many of the Data Scientists tend not to use conda environments from what I see and instead use venv or poetry. I'll see how the two interact with one another.

@mshodge
Copy link
Contributor Author

mshodge commented Jun 7, 2024

Looks promising so far. But led me down a rabbit hole of possibly tidying up the User Guidance and adding some sections: https://asdslack.slack.com/archives/G2T9SMUVD/p1717749226385309

@jacobwoffenden
Copy link
Member

Does that not mean they do provide 3.9 though and - Note: ... Python3.12 (noble) are not provided by deadsnakes as upstream ubuntu provides those packages.? See screenshot below too.

@mshodge they do, just doesn't look like its reflected in the PPA site, i've got a working PoC here ministryofjustice/analytical-platform-visual-studio-code#85

Looks promising so far. But led me down a rabbit hole of possibly tidying up the User Guidance and adding some sections: https://asdslack.slack.com/archives/G2T9SMUVD/p1717749226385309

I can't open that link, but let me know how you get on, if it doesn't work, I can publish a release candidate of my PoC next week and you can test that. There is a lot going on with pyenv and I'd need to test how it would function on our cloud development environment platform.

@jacobwoffenden jacobwoffenden self-assigned this Jun 7, 2024
@jacobwoffenden jacobwoffenden moved this from 👀 TODO to 🛂 In Review in Analytical Platform Jun 7, 2024
@mshodge
Copy link
Contributor Author

mshodge commented Jun 7, 2024

Thanks @jacobwoffenden. It's a slack post to the DEDs channel, copied here for ease:

Hi all. I thought I’d like to get your thoughts on some potential rearranging and adding of new sections of the AP User Guide now that Visual Studio Code is on the AP. Lots of the topics under JupyterLab are relevant to Visual Studio Code as well, so it seems weird to have them under JupyterLab only. Also have included a placeholder for Poetry as a Python package management system, and also a page on Moving from Visual Studio Code from JupyterLab which will have some of the benefits of VSCode but also some of the things to be aware (such as each having different versions of Python and how to resolve this).
Whilst we are tidying it up. What are the things missing from the AP Guidance under R/Python/RStudio/JupyterLab/Visual Studio Code? (edited)

Screenshot 2024-06-07 at 09 29 27

I'll keep testing the conda approach, it worked with a simple venv so I will check with poetry too today. If it works, it might just be simpler to promote that as the solution to cut down on the VSCode versions.

@jacobwoffenden
Copy link
Member

@mshodge has confirmed that we can close this FR, as the built in Conda can provide this functionality

@jacobwoffenden jacobwoffenden closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@github-project-automation github-project-automation bot moved this from 🛂 In Review to 🎉 Done in Analytical Platform Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants