I have installed python3 via brew (although python still uses the macOS version):
➜ ~ which python3
/opt/homebrew/bin/python3
➜ ~ which python
/usr/bin/python
➜ ~
I believe changing python to brew may create system instabilities. I have explicitly set python3 to use brew (i.e. "python.pythonPath": "/opt/homebrew/bin/python3").
Upon installation of the ms-python.python extension, I get these two errors:
workbench.desktop.main.js:734: workbench.desktop.main.js:1904: Activating extension 'ms-python.python' failed: Expected a string, got undefined.
workbench.desktop.main.js:1904: Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information.
Here is the information about VSCode:
Version: 1.55.2 (Universal)
Commit: 3c4e3df9e89829dce27b7b5c24508306b151f30d
Date: 2021-04-13T09:36:32.643Z (1 wk ago)
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Darwin arm64 20.3.0
(MacOS version 11.2.3: BigSur)
I have tried a older versions of the extension and they don't work. Any thoughts?
https://stackoverflow.com/users/2654002/ian-huff
https://stackoverflow.com/users/15093821/luciana-abud
Potentially related to
Unable to install extension 'ms-python.python' as it is not compatible with VS Code '1.39.2'
Error loading Python for VS Code IntelliCode
Related
I want to install Mesos on Oracle Linux 8.3 which does not have Internet access. I followed the process exactly in its site in part CentOS 7.1 and installed some packages before building mesos. I installed these packages using rpm -i name of package:
glib2-2.56.4-156.el8.x86_64.rpm
glib2-2.56.4-8.el8.x86_64.rpm
glib2-devel-2.56.4-156.el8.x86_64.rpm
glib2-devel-2.56.4-8.el8.x86_64.rpm
libcurl-7.61.1-14.el8.x86_64.rpm
libcurl-devel-7.61.1-14.el8.x86_64.rpm
libsecret-devel-0.18.6-1.el8.x86_64.rpm
libserf-1.3.9-9.module_el8.4.0+632+d2bf8782.x86_64.rpm
pcre-8.42-4.el8.x86_64.rpm
pcre-cpp-8.42-4.el8.x86_64.rpm
pcre-devel-8.42-4.el8.x86_64.rpm
pcre-utf16-8.42-4.el8.x86_64.rpm
pcre-utf32-8.42-4.el8.x86_64.rpm
cyrus-sasl-md5-2.1.27-5.el8.x86_64.rpm
python2-2.7.15-24.el8.x86_64.rpm
python2-2.7.18-7.module_el8.5.0+894+1c54b371.x86_64.rpm
python2-devel-2.7.15-24.el8.x86_64.rpm
python2-libs-2.7.15-24.el8.x86_64.rpm
python2-libs-2.7.18-7.module_el8.5.0+894+1c54b371.x86_64.rpm
python2-pip-9.0.3-18.module_el8.4.0+642+1dc4fb01.noarch.rpm
python2-pip-wheel-9.0.3-18.module_el8.5.0+743+cd2f5d28.noarch.rpm
python2-setuptools-wheel-39.0.1-13.module_el8.5.0+743+cd2f5d28.noarch.rpm
sqlite-devel-3.26.0-11.el8.x86_64.rpm
subversion-1.10.2-4.module_el8.3.0+703+ba2f61b7.x86_64.rpm
subversion-devel-1.10.2-4.module_el8.3.0+703+ba2f61b7.x86_64.rpm
subversion-libs-1.10.2-4.module_el8.3.0+703+ba2f61b7.x86_64.rpm
utf8proc-2.1.1-5.module_el8.3.0+703+ba2f61b7.x86_64.rpm
zlib-devel-1.2.11-16.el8_2.x86_64.rpm
Also, I installed python2.7 in this way:
tar zxvf Python-2.7.15.tgz
./configure --enable-optimizations
make altinstall
After that I set its path in ~/.bashrc like this:
alias python=/usr/local/bin/python2.7
export PATH=$PATH:/usr/local/bin/python2.7
For its pip also I run this command:
python2.7 -m ensurepip --default-pip
When I run python --version it show me Python 2.7.15.
Again extract Mesos folder and create build directory, then run ../configure; but I receive the same error before installing python 2.7.15:
configure: error: Mesos requires Python < 3.0
-------------------------------------------------------------------
The detected Python version is 3.6.
If you already have Python 2.6+ installed (and it's the default python on the path), you might want to check if you have the PYTHON environment variable set to a version of Python greater than 3.0.
However, when I run python command and receive this result which show that python 2.7.15 is default, mesos recognize python 3.6:
Python 2.7.15 (default, Sep 10 2022, 16:33:49)
Output of printenv:
LD_LIBRARY_PATH=/opt/oracle/instantclient_21_4:/opt/oracle/instantclient_21_4:/opt/oracle/instantclient_21_4:
LS_COLORS=rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=01;05;37;41:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;40:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.zst=38;5;9:*.tzst=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.wim=38;5;9:*.swm=38;5;9:*.dwm=38;5;9:*.esd=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.mjpg=38;5;13:*.mjpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=38;5;45:*.au=38;5;45:*.flac=38;5;45:*.m4a=38;5;45:*.mid=38;5;45:*.midi=38;5;45:*.mka=38;5;45:*.mp3=38;5;45:*.mpc=38;5;45:*.ogg=38;5;45:*.ra=38;5;45:*.wav=38;5;45:*.oga=38;5;45:*.opus=38;5;45:*.spx=38;5;45:*.xspf=38;5;45:
LC_MEASUREMENT=az_IR
M2_HOME=/usr/local/maven
SSH_CONNECTION=x.x.x.x 57648 xx.xx.xx.xx 22
LC_PAPER=az_IR
LC_MONETARY=az_IR
LANG=en_US.UTF-8
HISTCONTROL=ignoredups
HOSTNAME=kr311
OLDPWD=/root/Downloads/mesos/mesos-1.11.0
JAVA_HOME=/opt/oracle/java/jdk1.8.0_25
S_COLORS=auto
LC_NAME=az_IR
XDG_SESSION_ID=2
USER=root
PYSPARK_HOME=/usr/bin/python3.8
SELINUX_ROLE_REQUESTED=
PWD=/root/Downloads/mesos/mesos-1.11.0/build
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HOME=/root
SSH_CLIENT=x.x.x.x 57648 22
SELINUX_LEVEL_REQUESTED=
XDG_DATA_DIRS=/root/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
LC_ADDRESS=az_IR
SPARK_HOME=/opt/spark
LC_NUMERIC=az_IR
SSH_TTY=/dev/pts/0
MAIL=/var/spool/mail/root
TERM=xterm-256color
SHELL=/bin/bash
SELINUX_USE_CURRENT_RANGE=
PYSPARK_DRIVER_PYTHON=python3.8
SHLVL=1
LC_TELEPHONE=az_IR
LOGNAME=root
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/0/bus
XDG_RUNTIME_DIR=/run/user/0
PYSPARK_PYTHON=/usr/bin/python3.8
PATH=/opt/oracle/instantclient_21_4:/opt/oracle/java/jdk1.8.0_25/bin:/opt/oracle/instantclient_21_4:/usr/local/bin/python2.7:/opt/oracle/java/jdk1.8.0_25/bin:/opt/oracle/instantclient_21_4:/opt/oracle/java/jdk1.8.0_25/bin:/usr/local/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/bin/python2.7:/opt/spark/bin:/opt/spark/sbin:/root/bin:/opt/spark/bin:/opt/spark/sbin:/usr/local/bin/python2.7:/opt/spark/bin:/opt/spark/sbin
LC_IDENTIFICATION=az_IR
HISTSIZE=1000
LESSOPEN=||/usr/bin/lesspipe.sh %s
LC_TIME=az_IR_=/usr/bin/printenv
Would you please guide me what is wrong here?
Any help is really appreciated.
I am running into an error when using trying to install Python 3.8.6 with a shared library enabled. I am using PyEnv 1.2.23 on an M1 Macbook Pro.
In particular, running:
$ env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.6
returns the error message:
python-build: use openssl#1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.6.tar.xz...
-> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz
Installing Python-3.8.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/python-build.20210309124942.97911
Results logged to /var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/python-build.20210309124942.97911.log
Last 10 log lines:
checking size of _Bool... 1
checking size of off_t... 8
checking whether to enable large file support... no
checking size of time_t... 8
checking for pthread_t... yes
checking size of pthread_t... 8
checking size of pthread_key_t... 8
checking whether pthread_key_t is compatible with int... no
configure: error: Unexpected output of 'arch' on OSX
make: *** No targets specified and no makefile found. Stop.
I've also tried:
$ arch -x86_64 env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.8.6
and I get the same output.
I have also tried this:
$ brew install zlib
$ export LDFLAGS="-L/usr/local/opt/zlib/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include
and alas, no avail.
any ideas? thanks~
M1 support wasn't added to Python until 3.9.1. You'll need to upgrade.
I don't understand how R handles the Python environment and Python version and keep getting the error Error: could not find a Python environment for /usr/bin/python. I installed Miniconda and created a conda environment in the shell:
conda activate r-reticulate
Then, in R, I try to install keras (same problem with package tensorflow):
library(keras)
reticulate::use_condaenv()
install_keras(method = "conda", conda = reticulate::conda_binary())
... and get the following error:
Error: could not find a Python environment for /usr/bin/python
I tried to figure out what Python R should be using by
reticulate::py_config()
and get
python: /usr/bin/python
libpython: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
pythonhome: /System/Library/Frameworks/Python.framework/Versions/2.7:/System/Library/Frameworks/Python.framework/Versions/2.7
version: 2.7.16 (default, Jul 5 2020, 02:24:03) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.21) (-macos10.15-objc-
numpy: /Users/bestocke/Library/Python/2.7/lib/python/site-packages/numpy
numpy_version: 1.16.6
tensorflow: [NOT FOUND]
python versions found:
/usr/bin/python3
/usr/local/bin/python3
/usr/bin/python
I don't understand this. This seems to be using Python 2.7. When trying to figure out which Python is being used in the shell, I get:
> which python
/opt/miniconda3/envs/r-reticulate/bin/python
and
> ls -l /opt/miniconda3/envs/r-reticulate/bin/python
lrwxr-xr-x 1 username wheel 9 Aug 2 15:21 /opt/miniconda3/envs/r-reticulate/bin/python -> python3.6
Suggesting Python 3.6 should be used.
What am I getting wrong here?
Try to follow the guide at https://tensorflow.rstudio.com/installation/:
In your R-studio console :
install.packages("tensorflow")
library(tensorflow)
install_tensorflow()
If you have not installed Anaconda / Miniconda manually, then at step no. 3, a prompt will ask your permission to install Miniconda. If you already have conda installed, then :
Create new environment r-reticulate in conda : conda create -n r-reticulate
Install tensorflow from R-studio console with parameters : install_tensorflow(method = 'conda', envname = 'r-reticulate')
Load the reticulate package library(reticulate)
Activate the conda environment in R-studio use_condaenv('r-reticulate')
Load the tensorflow libray library(tensorflow)
Check if tensorflow is active tf$constant("Hellow Tensorflow")
References :
https://tensorflow.rstudio.com/installation/
https://rstudio.github.io/reticulate/
I installed using virtualenv, and I found that I have to specify the full path to the env by envname. It does not work by method="virtualenv", envname="r-reticulate"
I hope there is time to add information. I tried to do what Anugerah Erlaut said, but trying to install Keras GPU on R-studio Server, through WSL.
I knew the solution would work because I tried on another computer, but installing on Windows, and Keras CPU. After testing a while (and get frustrated), it seems that Rstudio does not have permissions to change the r-reticulate env.
So, I tried the solution running or "pure R", on bash command line, and it worked just fine!
I'm trying to import gensim from a conda environment via R with reticulate. The conda environment itself imports gensim fine, it's only when I interface using reticulate that I have the problem. The code below shows exactly what I'm running, the output, and the environment (it's Mint 19.1, which is Ubuntu 18.04)
I've searched in vain for anything that even relates to this, although I have also run:
sudo apt install python-dev libffi-dev libssl-dev
Because I read that might help. I also ran:
conda install urllib3 and was told it was already installed.
To add to my frustration, it runs fine on my Mint 18.3 box, but I can't for the life of me understand what the difference might be.
library(reticulate)
use_condaenv("hello", required = TRUE)
py_run_string("import gensim")
This gives the following error:
Error in py_run_string_impl(code, local, convert) :
ImportError: cannot import name 'ssl' from 'urllib3.util.ssl_' (/home/chris/anaconda3/envs/hello/lib/python3.7/site-packages/urllib3/util/ssl_.py)
The output of sessionInfo() :
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 19.1
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /home/chris/anaconda3/envs/hello/lib/libmkl_rt.so
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reticulate_1.12
loaded via a namespace (and not attached):
[1] compiler_3.6.0 Matrix_1.2-17 tools_3.6.0 Rcpp_1.0.1 grid_3.6.0 jsonlite_1.6 lattice_0.20-38
py_discover_config()
python: /home/chris/anaconda3/envs/hello/bin/python
libpython: /home/chris/anaconda3/envs/hello/lib/libpython3.7m.so
pythonhome: /home/chris/anaconda3/envs/hello:/home/chris/anaconda3/envs/hello
version: 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0]
numpy: /home/chris/anaconda3/envs/hello/lib/python3.7/site-packages/numpy
numpy_version: 1.16.3
NOTE: Python version was forced by use_python function
I had the same error when running the code from RStudio. It turned out that it worked when installing RStudio within the conda environment. But when using RStudio installed as a deb package (/usr/bin/rstudio), it failed. So you might want to install R in the same conda environment that you’re using for gensim.
I'm installing ROS Kinetic on MacOS Sierra 10.12.6 under a seperate environment under Python Anaconda distribution.
Here is my python version(my seperate python environment in Anaconda is called "ros-kinetic"):
(ros-kinetic) jizhe#jizhedeMacBook-Pro ~/ros_catkin_ws python --version
Python 3.6.4 :: Anaconda, Inc.
I followed the guide: http://wiki.ros.org/kinetic/Installation/OSX/Homebrew/Source.
When I execute the "rosdep install" command, I got the following error:
(ros-kinetic) jizhe#jizhedeMacBook-Pro ~/ros_catkin_ws rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
actionlib: No definition of [python-wxtools] for OS [osx]
catkin: No definition of [google-mock] for OS [osx]
roslisp: No definition of [google-mock] for OS [osx]
Obviously, there is something wrong with the package "python-wxtools" and "google-mock".
I've already install the wxpython via "brew install wxpython", and here is the wxpython info:
(ros-kinetic) jizhe#jizhedeMacBook-Pro ~/ros_catkin_ws brew info wxpython
wxpython: stable 3.0.2.0 (bottled)
Python bindings for wxWidgets
https://www.wxwidgets.org/
/usr/local/Cellar/wxpython/3.0.2.0_1 (1,108 files, 37.9MB) *
Poured from bottle on 2018-02-24 at 03:56:21
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wxpython.rb
==> Dependencies
Required: wxmac ✔
==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p /Users/jizhe/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/jizhe/Library/Python/2.7/lib/python/site-packages/homebrew.pth
And I've already run the command:
$ mkdir -p ~/Library/Python/2.7/lib/python/site-packages
$ echo "$(brew --prefix)/lib/python2.7/site-packages" >> ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
So, what's wrong with the package "google-mock" and "python-wxtools", how can I solve this problem?
Try installing with --skip-keys python-wxtools --skip-keys google-mock. It worked for me.
There is a ticket for this issue. Basically the workaround is to install googletest manually. Not sure what's wrong with python-wxtools.
edit: If you're using ros-install-osx, you can add the following lines to your rosdeps.yaml file:
google-mock:
osx:
homebrew:
packages: []
I found this question from a Google search, just for your information in 2021 installing ROS in conda also on macOS should be much straightforward, see the following links:
https://medium.com/robostack/cross-platform-conda-packages-for-ros-fa1974fd1de3
https://github.com/RoboStack/ros-noetic