Skip to content

Winpython64-3.8.2.0: \settings\ folder not used and winpython.ini is ignored #839

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

Open
captaindet opened this issue Apr 17, 2020 · 18 comments

Comments

@captaindet
Copy link

as the subject indicates i have the following problems with Winpython64-3.8.2.0

a) \settings\ folder not used

all package settings (.CONFIG folders) are now stored in c:\Users\USER
this includes .ipython, .matplotlib, .spyder-py3 and others
while spyder is creating a little dummy \settings.spyder-py3, it does save all actual settings to c:\Users\USER.spyder-py3.

i like my settings being portable and want none of them in c:\Users\USER\

b) \settings\winpython.ini entries seems to be ignored too

typically, i change the defaults so that all settings/configs are stored where i have my python project located. something like:

[environment]
HOME = path-to-my-python-stuff
PYTHONPATH = path-to-my-python-stuff\lib-a;path-to-my-python-stuff\lib-b
WINPYWORKDIR = path-to-my-python-stuff\notebooks

however, this is now broken in the same way as (a), all settings end up in c:\Users\USER\ again, except for the additional dummy path-to-my-python-stuff.spyder-py3

this is with Winpython64-3.8.2.0

i am not upgrading every version. i have just upgraded from Winpython64-3.7.4.1 which did not have these issues.

@stonebig
Copy link
Contributor

I don't see a difference in the WinPython scripts themselves. Did you root cause what may have caused this change ?

@stonebig
Copy link
Contributor

stonebig commented Apr 17, 2020

interesting: it seems related to Python-3.8 itself

WinPython-3.7.7.1 build1

Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32
>>> Type "copyright", "credits" or "license()" for more information.
>>> from spyder.config.base import get_home_dir
>>> get_home_dir()
 'C:...\\WPy64-3771b1\\settings'
>>> import spyder
>>> spyder.__version__
'4.1.2'
import os.path as osp
>>> osp.expanduser('~')
 'C:...\\WPy64-3771b1\\settings'

WinPython-3.8.2.1 build1

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> from spyder.config.base import get_home_dir
>>> get_home_dir()
'C:\\Users\\the_user'
>>> import spyder
>>> spyder.__version__
'4.1.2'
import os.path as osp
>>> osp.expanduser('~')
'C:\\Users\\the_user'

@stonebig
Copy link
Contributor

stonebig commented Apr 17, 2020

so were up to this problem in Python-3.8 not working as dreamed:

import os.path as osp
>>> osp.expanduser('~')

... where is that code on github ? ah , ok : python-3.7.7.amd64\Lib\os.py

@stonebig
Copy link
Contributor

Well, I don't truly find why under Python-3.8 , we get a different answer for

import os.path as osp;osp.expanduser('~')

@captaindet, could you inquire this, and look for a way to get it back to beloved 3.7 behavior ?

@stonebig
Copy link
Contributor

stonebig commented Apr 17, 2020

ok, found it. Now the variable looked for is USERPROFILE, no more HOME (at first).

so if you simply tune your scripts\env.bat as follow, that should solves the issue:

from

set HOME=%WINPYDIRBASE%\settings
rem set WINPYDIRBASE=

to:

set HOME=%WINPYDIRBASE%\settings
set USERPROFILE=%HOME%
rem set WINPYDIRBASE=

it's a change in cpython in lib\pathlib.y:
pathlib.py
image

@stonebig
Copy link
Contributor

stonebig commented Apr 17, 2020

apparently .... it's a correction of "considered bad behavior" that has been done January 28th 2020, on python-3.8.2 and 3.9.0a5 (and NOT on Python-3.7, unchanged):

https://bugs.python.org/issue36264

python/cpython@c45a2aa

@stonebig
Copy link
Contributor

so the apparent solution is to specify USERPROFILE=%HOME%

@stonebig
Copy link
Contributor

you can try in next build, or just apply the one-liner in your current WinPython-3.8 and 3.9

@stonebig
Copy link
Contributor

image

stonebig added a commit to stonebig/winpython that referenced this issue Apr 17, 2020
python-3.8 and 3.9 don't use HOME anymore to get user settings, but USERPROFILE
@captaindet
Copy link
Author

thanks stonebig for figuring out the root cause so fast.

it seems like just adding
USERPROFILE = %HOME%
to the winpython.ini will do the trick already, without messing around with the env.bat.

ultimately i wanted to redirect to my folder of choice anyway, which seems to work now if winpython.ini is changed to

...
[environment]
HOME =  path-to-my-python-stuff
USERPROFILE = %HOME%
...

@stonebig
Copy link
Contributor

good remark

@stonebig
Copy link
Contributor

set USERPROFILE=%HOME% makes VSCode not starting.
same error as here electron/electron#10054 (comment)

@stonebig
Copy link
Contributor

on VScode side, to get ipywidgets it needs settings.json change:

{
"python.pythonPath": "${env:WINPYDIR}\\python.exe",
"python.dataScience.widgetScriptSources": [
"jsdelivr.com",
"unpkg.com"
],

}

@stonebig
Copy link
Contributor

stonebig commented Apr 25, 2020

so... on Python-3.8 if we set USERPROFILE=%HOME% we have to pre-create:

  • %WINPYDIRBASE%\settings\AppData\Roaming
  • %WINPYDIRBASE%\settings\AppData\Local
  • %WINPYDIRBASE%\settings\AppData\LocalLow

Otherwise VScode (Electron.js) blows-up

@stonebig
Copy link
Contributor

I don't dare setting USERPROFILE=%HOME% per default, as too much things then goes there.

But the option is just for you to un-comment the line on env.bat

as %WINPYDIRBASE%\settings\AppData\settings\Roaming is created, VSCode won't blow up like in electron/electron#10054 (comment)

@stonebig
Copy link
Contributor

there is also the scripts that we may invert the names, that can be of use or reworked later:

  • make_working_directory_be_not_winpython.bat
  • make_working_directory_be_winpython.bat

@RoyiAvital
Copy link

The problem is when Extracting the EXE (Installers) there is no configuration files in the Settings folder.
Where are they?

Is there a way to have the exact same experience with 3.8.3 as with previous releases?

@duperweb
Copy link

So the reason that happened it is because you turn on the state and the wind python initiative files (winoython.ini) don't enabled the STATE, just let as it is or you can change the user profile to winpydirbase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants