PlatformIO Community

Problem with platformio register

Hello,

I was attempting to try-out the features of platformio remote, by first registering my account. I followed the instructions on the community post for installing beta 3.2. I guess that gives me the current github head commit 2ac00fb.

I tried running platformio register, but it gives the error ImportError: No module named site. This is despite giving the message pysite-pioplus @ 0.3.0 has been successfully installed! on the first run.

I tried this out using the win32 platform, all from the command line with no IDE integration.

regards
David

Where is installed Python in your system?

I remember that you use 64-bit Python. I’ve jsut install 64-bit Python in VM to C:\Python27_64 and it works very well.
Please provide all details how to reproduce this issue.

Thanks!

@ivankravets I have tried with both 32 bit and 64 bit python (installed e.g. in C:\python27) and always get this error. I tried removing my .platformio folder, and removing site-packages/platformio but always the problem occurs. Is there another place I should be looking for files to clear out?

  • Please install this debug version of PIO Core 3.2:
    pip install -U https://github.com/platformio/platformio-core/archive/feature/debug-win-pioplus.zip
  • Run pio account register command
  • Please report an output of debug, PYTHONPATH

When running under 32 bit python location in C:\Python27 (installed with the standard python windows installer), I get the following output:

debug, PYTHONPATH c:\python27\lib\site-packages
ImportError: No module named site

What is a version of your Windows OS? Win10?

Could you try this?

set PYTHONPATH=c:\python27\lib
pio account register

I’m using windows 7.

Your suggestion definitely made a difference, I now get the error:

debug, PYTHONPATH c:\python27\lib;c:\python27\lib\site-packages
Traceback (most recent call last):
  File "main.py", line 12, in init main (C:\users\vagrant\appdata\local\temp\tmpmqvpk4\main.c:2978)
  File "c:\python27\lib\site-packages\requests\__init__.py", line 60, in <module>
    from .packages.urllib3.exceptions import DependencyWarning
  File "c:\python27\lib\site-packages\requests\packages\__init__.py", line 29, in <module>
    import urllib3
ImportError: No module named urllib3

The obvious next thing to try was pip install urllib3, which installs fine. pio account register then gives the following error

debug, PYTHONPATH c:\python27\lib;c:\python27\lib\site-packages
Traceback (most recent call last):
  File "main.py", line 12, in init main (C:\users\vagrant\appdata\local\temp\tmpmqvpk4\main.c:2978)
  File "c:\python27\lib\site-packages\requests\__init__.py", line 60, in <module>
    from .packages.urllib3.exceptions import DependencyWarning
  File "c:\python27\lib\site-packages\requests\packages\__init__.py", line 29, in <module>
    import urllib3
  File "c:\python27\lib\site-packages\urllib3\__init__.py", line 8, in <module>
    from .connectionpool import (
  File "c:\python27\lib\site-packages\urllib3\connectionpool.py", line 7, in <module>
    from socket import error as SocketError, timeout as SocketTimeout
  File "c:\python27\lib\socket.py", line 47, in <module>
    import _socket
ImportError: No module named _socket

Motivated by your hint to add things to PYTHONPATH, I had a look at my sys.path which has the following contents:

['', 'c:\\python27\\lib', 'C:\\Python27\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages']

Given that _socket suggests a python binary library, I tried:

set PYTHONPATH=C:\python27\lib;C:\python27\dlls

Running pio account register after this was successful!

Does this give you enough information to turn this workaround into a fix? Does this indicate that my configuration is somehow broken, or is this a problem with platformio?

Thank you for the valuable information. I’ve just prepared new binaries that should print sys.path on a binary side. Please test if and compare results.

This is mine output:

C:\Users\User>pio account info
PYTHON SYSPATH ['C:\\Users\\User\\.platformio\\packages\\tool-pioplus', 'c:\\python27\\lib\\site-pac
kages', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\Lib', 'C:\\Python27\\DLLs', 'C:\\Pytho
n27\\Lib\\lib-tk', 'C:\\Users\\User', 'C:\\Users\\User\\.platformio\\packages\\tool-pioplus', 'C:\\P
ython27']
PlatformIO Plus (https://pioplus.com) v0.6.4

P.S: How do you install Python?

I still get the same error ImportError: No module named site, unless I run

set PYTHONPATH=C:\python27\lib;C:\python27\dlls

Once this has run, I get the following output

C:\Users\dap124>pio account info
debug, PYTHONPATH C:\python27\lib;C:\python27\dlls;c:\python27\lib\site-packages

PYTHON SYSPATH ['C:\\Users\\dap124\\.platformio\\packages\\tool-pioplus', 'C:\\python27\\lib', 'C:\\python27\\dlls', 'c:\\python27\\lib\\site-packages', 'C:\\Python27\\python27.zip', 'C:\\Users\\dap124', 'C:\\Users\\dap124\\.platformio\\packages\\tool-pioplus', 'C:\\Python27']
PlatformIO Plus (https://pioplus.com) v0.6.4

This python was installed via the official windows v2.7.12 windows installer. There is an additional anaconda python distribution on my system, but I checked carefully that there is no trace of it in my path, so it shouldn’t be causing any interference.

I’m working on a new approach that should resovle this issue. I’ll report here the further details.

Please try out the latest PIO Core 3.2b6 via pio upgrade. Does it work now?

Thanks @ivankravets! I can confirm that this works on both my 32 bit and 64 bit python installations.

(Of course I have to choose between having the 32 bit or 64 version of tool-pioplus and pysite-pioplus installed, but I only installed the 32 bit python to help debug platformio, so I don’t need both.)

1 Like