AdrianLC / sublime-text-virtualenv

Manage your virtualenvs directly from Sublime Text 3
https://github.com/AdrianLC/sublime-text-virtualenv
MIT License
36 stars 17 forks source link

ST4 does not load Default into the Python 3.3 environment any longer #22

Open mcoliver opened 3 years ago

mcoliver commented 3 years ago

https://github.com/AdrianLC/sublime-text-virtualenv/blob/e05905ad508c173904b62d9e9e083ca3944c1370/commands.py#L11

Tried with ST4 and got the following in the console

Packages/Virtualenv.sublime-package/commands.py", line 126, in <module>
AttributeError: 'module' object has no attribute 'exec'

To get this package working in ST4 I unzipped the package, created a file in the root of this package called .python-version with the contents of 3.8, and zipped it up. Now working and backwards compatible with ST2 and ST3. Will submit a PR.

SebastianGergen commented 3 years ago

or downgrade back to sublime text 3, and it works again: in ubuntu check available versions and install a version 3x (in my case 3211):

apt-cache policy sublime-text 
sudo apt-get install sublime-text=3211
trefmanic commented 3 years ago

or downgrade back to sublime text 3, and it works again: in ubuntu check available versions and install a version 3x (in my case 3211):

apt-cache policy sublime-text 
sudo apt-get install sublime-text=3211

When I do that, after launching sublime-text i'm getting entirely black window, no menu, or anything.

To get this package working in ST4 I unzipped the package, created a file in the root of this package called .python-version with the contents of 3.8, and zipped it up

That, however, worked. Thank you.

polilies commented 3 years ago

https://github.com/AdrianLC/sublime-text-virtualenv/blob/e05905ad508c173904b62d9e9e083ca3944c1370/commands.py#L11

Tried with ST4 and got the following in the console

Packages/Virtualenv.sublime-package/commands.py", line 126, in <module>
AttributeError: 'module' object has no attribute 'exec'

To get this package working in ST4 I unzipped the package, created a file in the root of this package called .python-version with the contents of 3.8, and zipped it up. Now working and backwards compatible with ST2 and ST3. Will submit a PR.

Can you be more specific espacially for the paths' of the files.

mcoliver commented 3 years ago

By default on macOS the package is installed to:

~/Library/Application\ Support/Sublime\ Text\ 3/Installed\
Packages/Virtualenv.sublime-package

But you can also get to where your packages are installed (on any OS) via ST by going to:

Sublime Text menu --> Preferences --> Browse Packages

Since the package is a zip file (even though it does not have a zip extension) you can just append the package with the new file.

Always beware of copy/pasting code in your terminal but this is what worked for me:

cd /var/tmp
echo "3.8" > .python-version
zip -u ~/Library/Application\ Support/Sublime\ Text\ 3/Installed\
Packages/Virtualenv.sublime-package .python-version
rm .python-version

You can verify its in the package by running the below command to list the package contents

unzip -l ~/Library/Application\ Support/Sublime\ Text\ 3/Installed\ Packages/Virtualenv.sublime-package
polilies commented 3 years ago

Thanks mcoliver. It might be little bit different things goes in windows iOS. So I uninstalled build 4xxx and installed 3211. It worked for me. Do not forget to rename /Program Files/Sublime text 3/ to something else like Sublime text 3_old after uninstalling process. Niceday

SebastianGergen commented 3 years ago

In ubuntu the folder is "~/.config/sublime-text-3/Installed Packages/" and the solution from @mcoliver works well! Better than keeping the old version!

shiplu commented 2 years ago

For those who wants to know which work around actually worked, please try @mcoliver's solution.

keeb-dev commented 2 years ago

Doesn't work for me at all, even python3.10

Aleksusss commented 2 years ago

Doesn't work for me at all, even python3.10

I tried to write "3.9" in .python-version but it didn't work but "3.8" worked like a charm. Just try it.

arkziael commented 1 year ago

Doesn't work for me at all, even python3.10

I tried to write "3.9" in .python-version but it didn't work but "3.8" worked like a charm. Just try it.

Thats because only 3.8 is accepted - https://www.sublimetext.com/docs/api_environments.html#selecting-the-python-version

CatzHoekk commented 1 year ago

Thx everyone,

a .python-version with 3.8 as only content directly in the root of the .sublime-package archive works like a charm.

@mcoliver code to produce that uses quotation marks that would, at least on windows, be piped into the file which will be invalid. You want a plain 3.8. Unnecessary /n/r are fine tho

echo 3.8 > .python-version