Can't install VSCode IDE on Mac OS X (10.12.6)

Hi,

I have been trying to install the VSCode IDE package, but on opening a new window in VSCode I get the following message:

Installing PlatformIO Core…
Please don’t close this window and don’t open other folders until this process is completed.
Failed to install PlatformIO IDE.

Right before a Window pops up with the following message:

Virtualenv Create: Traceback (most recent call last):
File “/Users/Oscar/.platformio/.cache/tmp-2399SLQU7JE3cU7U/virtualenv-14.0.6/virtualenv.py”, line 29, in
import tempfile
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py”, line 34, in
from random import Random as _Random
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py”, line 49, in
import hashlib as _hashlib
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py”, line 139, in
globals()[__func_name] = __get_hash(__func_name)
File “/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py”, line 72, in __get_builtin_constructor
import _md5
File “build/bdist.macosx-10.12-intel/egg/_md5.py”, line 7, in
File “build/bdist.macosx-10.12-intel/egg/_md5.py”, line 4, in bootstrap
File “/Library/Python/2.7/site-packages/pkg_resources/init.py”, line 1205, in resource_filename
self, resource_name
File “/Library/Python/2.7/site-packages/pkg_resources/init.py”, line 1717, in get_resource_filename
self._extract_resource(manager, self._eager_to_zip(name))
File “/Library/Python/2.7/site-packages/pkg_resources/init.py”, line 1753, in _extract_resource
outf, tmpnam = _mkstemp(".$extract", dir=os.path.dirname(real_path))
File “/Library/Python/2.7/site-packages/pkg_resources/init.py”, line 2962, in _mkstemp
return tempfile.mkstemp(*args, **kw)
AttributeError: ‘module’ object has no attribute ‘mkstemp’

Could you provide an output from

echo $PATH
echo $PYTHONPATH
python --version
pip --version
pip list

I have managed to get it installed by logging in as a “guest user” on my computer, then install the VSCode IDE, copy the .platformio folder to my home folder and it works. But I don’t know if this way is going to give me problems later on.
As I suspect there is something wrong with my Python installation and I don’t know much about Python.

“echo $PATH”

/opt/local/bin:/opt/local/sbin:/Users/Oscar/.nvm/versions/node/v8.1.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/Cellar/android-sdk/24.4.1/tools:/usr/local/Cellar/android-sdk/24.4.1/platform-tools:/usr/local/gcc_arm/bin:/usr/local/mysql/bin

echo $PYTHONPATH

no output

python --version

Python 2.7.10

pip --version

pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)

pip list

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
altgraph (0.10.2)
arrow (0.10.0)
astroid (1.5.3)
backports.functools-lru-cache (1.4)
bdist-mpkg (0.5.0)
beautifulsoup4 (4.5.3)
bonjour-py (0.3)
bottle (0.12.13)
certifi (2017.11.5)
chardet (3.0.4)
click (5.1)
colorama (0.3.9)
configparser (3.5.0)
enum34 (1.1.6)
funcsigs (1.0.2)
future (0.15.2)
fuzzywuzzy (0.15.0)
hashlib (20081119)
hidapi (0.7.99.post19)
idna (2.6)
intelhex (2.1)
isort (4.2.15)
Jinja2 (2.8)
junit-xml (1.7)
lazy-object-proxy (1.3.1)
lockfile (0.12.2)
macholib (1.5.1)
MarkupSafe (0.23)
matplotlib (1.3.1)
mbed-cli (1.1.1)
mbed-greentea (1.2.1)
mbed-host-tests (1.1.2)
mbed-ls (1.2.3)
mccabe (0.6.1)
mercurial (3.9.1)
mock (2.0.0)
modulegraph (0.10.4)
numpy (1.8.0rc1)
pbr (1.10.0)
pip (9.0.1)
platformio (3.4.1)
prettytable (0.7.2)
project-generator (0.9.10)
project-generator-definitions (0.2.33)
py2app (0.7.3)
pylint (1.7.4)
pyobjc-core (2.5.1)
pyobjc-framework-Accounts (2.5.1)
pyobjc-framework-AddressBook (2.5.1)
pyobjc-framework-AppleScriptKit (2.5.1)
pyobjc-framework-AppleScriptObjC (2.5.1)
pyobjc-framework-Automator (2.5.1)
pyobjc-framework-CFNetwork (2.5.1)
pyobjc-framework-Cocoa (2.5.1)
pyobjc-framework-Collaboration (2.5.1)
pyobjc-framework-CoreData (2.5.1)
pyobjc-framework-CoreLocation (2.5.1)
pyobjc-framework-CoreText (2.5.1)
pyobjc-framework-DictionaryServices (2.5.1)
pyobjc-framework-EventKit (2.5.1)
pyobjc-framework-ExceptionHandling (2.5.1)
pyobjc-framework-FSEvents (2.5.1)
pyobjc-framework-InputMethodKit (2.5.1)
pyobjc-framework-InstallerPlugins (2.5.1)
pyobjc-framework-InstantMessage (2.5.1)
pyobjc-framework-LatentSemanticMapping (2.5.1)
pyobjc-framework-LaunchServices (2.5.1)
pyobjc-framework-Message (2.5.1)
pyobjc-framework-OpenDirectory (2.5.1)
pyobjc-framework-PreferencePanes (2.5.1)
pyobjc-framework-PubSub (2.5.1)
pyobjc-framework-QTKit (2.5.1)
pyobjc-framework-Quartz (2.5.1)
pyobjc-framework-ScreenSaver (2.5.1)
pyobjc-framework-ScriptingBridge (2.5.1)
pyobjc-framework-SearchKit (2.5.1)
pyobjc-framework-ServiceManagement (2.5.1)
pyobjc-framework-Social (2.5.1)
pyobjc-framework-SyncServices (2.5.1)
pyobjc-framework-SystemConfiguration (2.5.1)
pyobjc-framework-WebKit (2.5.1)
pyOCD (0.8.0)
pyOpenSSL (0.13.1)
pyparsing (2.0.1)
pyserial (3.4)
python-dateutil (2.6.1)
pytz (2013.7)
PyYAML (3.11)
requests (2.18.4)
scipy (0.13.0b1)
semantic-version (2.6.0)
setuptools (28.0.0)
singledispatch (3.4.0.3)
six (1.11.0)
urllib3 (1.22)
validator.py (1.2.5)
vboxapi (1.0)
websocket-client (0.37.0)
wrapt (1.10.11)
xattr (0.6.4)
xmltodict (0.10.2)
zope.interface (4.1.1)

It looks that you have multiple Pythons and PlatformIO Cors in a system.

http://docs.platformio.org/en/latest/faq.html#multiple-pio-cores-in-a-system

Hi Ivan,

Thanks for your input so far. But I am afraid I still have the same problem.

It looks that you have multiple PlatformIO Cors in a system

Okay, I have applied the solution listed in your link and uninstalled with pip. Just to be sure, I also executed the brew uninstall command.

It looks that you have multiple Pythons

How can you tell? And what should I do about it?

Thank you for your help.

Could you provide list of

brew list

android-sdk
arangodb
atk
atomicparsley
autoconf
automake
boost
cairo
cmake
doxygen
faac
ffmpeg
fontconfig
freetype
gdbm
gdk-pixbuf
get_iplayer
gettext
glib
gobject-introspection
graphite2
gtk+
harfbuzz
hicolor-icon-theme
hidapi
highlight
icu4c
id3lib
id3v2
jpeg
lame
libffi
libftdi
libpng
libtiff
libtool
libusb
libusb-compat
lua
mongodb
mplayer
open-ocd
openssl
openssl@1.1
pango
pcre
phantomjs
pixman
pkg-config
pyenv
python
readline
rtmpdump
scons
sqlite
stlink
wget
x264
xvid
xz

Please open system terminal (not in IDE) and type

sudo pip uninstall platformio

Then please remove %HOME_DIR%/.platformio/penv folder and restart IDE.

Hi Ivan,

I had done that already, but this did not do the trick. However, I seemed to have an incomplete MacPorts installation that messed up my Python. Commenting out the path to MacPorts did the trick.

Thanks again for your help, much appreciated!