protoc-gen-gprc_python: program not found or is not executable - python

When I try to generate proto files using Python's grpc_tools.protoc library:
python -m grpc_tools.protoc -I protos --python_out=. --gprc_python_out=. protos/test.proto
it fails with the error
protoc-gen-gprc_python: program not found or is not executable
--gprc_python_out: protoc-gen-gprc_python: Plugin failed with status code 1.
I've already installed the following packages in my conda environment:
conda install -c conda-forge grpclib
conda install grpcio grpcio-tools
$ python -m grpc_tools.protoc --version
libprotoc 3.6.1
What is my conda environment missing that is prevent me from running my above command? Thank you

Typo.
You want --grpc_python_out=.
You have --gprc_python_out=.

Related

pip not working while trying to install torch

I'm trying to install torch for ml-agents and when I run the command
pip install torch~=1.7.1 -f https://download.pytorch.org/whl/torch_stable.html
and it answers:
No Python at 'C:\Program Files (x86)\Python38-32\python.exe'
review/reinstall your python installation. The issue is related to Python and Pip, not that library.
First try to fix:
python --version
then
pip --version

Conda build package to be compatible with specific python version

I am trying to create a conda package which should be compatible with all python versions greater than or equal to 3.7.
I specified this requirement in my conda.recipe/meta.yaml:
requirements:
host:
- python >=3.7
- pip
run:
- python >=3.7
- importlib-resources >=1.4.0
- ...
For my build command, I first activated a Python 3.7 conda environment, then I specified the build command should use the same environment, and I also specified that the build command should use Python 3.7 just to be safe:
$ CONDA_ENV=/path/to/py3.7/conda/env
$ conda create --yes -p $CONDA_ENV python=3.7 conda-build conda-verify importlib-resources>=1.4.0 # ...remaining reqs
$ conda activate $CONDA_ENV
$ conda build --python=3.7 -p $CONDA_ENV /path/to/package/dir
The build step in conda.recipy/meta.yaml too uses this same environment:
build:
script: bash -c 'source ~/.bashrc && conda activate /path/to/py3.7/conda/env && python -m pip install --no-deps --ignore-installed -vv /path/to/package/dir'
The problem
Running the above commands creates this file:
my-package-1.1.0-py310_0.tar.bz2
I don't get why py310 is in the package name, I did everything I can think of to make it compatible with 3.7 as well.
Here is what happens when I try to create an environment with both python 3.7 and my created package (after uploading the tar.bz2 file to my conda repo):
$ conda create -p ~/temp/conda python=3.7 my-package
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found to be incompatible with each other:
Output in format: Requested package -> Available versions
Package python conflicts for:
python=3.7
my-package -> python[version='>=3.10,<3.11.0a0']
my-package -> importlib-resources[version='>=1.4.0'] -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.8,<3.9.0a0|>=3|>=3.6|>=3.7|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0|3.4.*|>=3.9,<3.10.0a0|3.10.*']
The following specifications were found to be incompatible with your system:
- feature:/linux-64::__glibc==2.27=0
- feature:|#/linux-64::__glibc==2.27=0
Your installed version is: 2.27
But if I don't specify 3.7 when creating the environment it works fine, but creates an environment with 3.10.
$ conda create -p ~/temp/conda python my-package
Question
How can I make my-package compatible with Python 3.7?
After much unproductive research an unending amounts of trial and error, I found that I should have made my package not specific to any python version by adding noarch: python to my meta.yaml:
build:
noarch: python
script: bash -c 'source ~/.bashrc && conda activate /path/to/py3.7/conda/env && python -m pip install --no-deps --ignore-installed -vv /path/to/package/dir'

Error installing etetoolkit. When installing using anaconda

I followed the directions to install etetoolkit for mac.
# Install Minconda (you can ignore this step if you already have Anaconda/Miniconda)
curl -L 'http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh' -o Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b -p ~/anaconda_ete/
export PATH=~/anaconda_ete/bin:$PATH;
# Install ETE and external tools
conda install -c etetoolkit ete3 ete_toolchain
# Check installation
ete3 build check
I get an error when I run conda install -c etetoolkit ete3 ete_toolchain
Error:
UnsatisfiableError: The following specifications were found to be
incompatible with the existing python installation in your
environment:
ete3 -> python[version='>=2.7,<2.8.0a0,>=3.5,<3.6.0a0,>=3.6,<3.7.0a0']
ete_toolchain -> python[version='>=2.7,<2.8.0a0,>=3.5,<3.6.0a0,>=3.6,<3.7.0a0'
I ran the [package installer][2] for anaconda 3.7. (I don't think I actually had to do this.)
From terminal run: conda install python=2.7
Then conda install -c etetoolkit ete3 ete_toolchain
Then I verified this worked by running ete3 build check. In the results clustalo: MISSING displayed, but that's a new problem to solve.
UPDATE
The final problem was solved by running conda install -c etetoolkit ete3_external_apps
There is a type-o in the instructions given by ete3. Use this instead.

F2PY not working on OpenSuse 42.3

I'm running OpenSuse 42.3, and I have installed numpy 1.13.1 using pip install numpy.
I run the command:
f2py -c PDFF.f -m PDFF
I get the error:
error: file '/usr/lib64/python2.7/site-packages/numpy/f2py/src/fortranobject.c' does not exist
If I do an ls on that directory, there are no files in the /src directory of f2py. I had no issues when I was running on OpenSuse 13.2. We recently upgraded to 42.3.
Is this a known issue?
The version of pip that I was using is linked to Python3.4 by default. So all modules that I install using pip install' are added to the Python3.4 system directory. I did a zypper install python-pip, which added the pip module to the Python2.7 build on the system. I then ran sudo python -m pip install --upgrade numpy, and now the appropriate files have been added to the /src directory in the f2py utility for the Python2.7 build.

How to create virtualenv with python 3.6 venv

I'm trying to create a python virtualenv using anaconda python3.6 in ubuntu 16.04. Following https://docs.python.org/3/library/venv.html , I've tried
deploy#server:~/miniconda3/bin$ python3 -m venv ~/test
Error: Command '['/home/deploy/test/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
operating from the miniconda directory at ~/miniconda3/bin (screenshot). How can I this working?
edit:
deploy#server:~/miniconda3/bin$ /home/deploy/test/bin/python3 -Im ensurepip --upgrade --default-pip
/home/deploy/test/bin/python3: No module named ensurepip
If you are using anaconda, you should be using conda environments.
conda create --name test
For more information, see Managing Environments.
EDIT In response to OP wanting to use virtualenvs.
The error is with python not being able to find pip. You can get around this by installing it manually.
python3 -m venv test --without-pip
cd test
source bin/activate
curl https://bootstrap.pypa.io/get-pip.py | python3
At this point you will have a basic virtualenv with pip installed.

Categories