How do Resolve the Following Error When Installing Twisted by Pip? - twisted

I am unable to install Twisted. I've looked at other posts but I'm unable to ascertain what's wrong. Can someone help?
Building wheel for twisted (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/username/.local/share/virtualenvs/scrapy-woEp5YDx/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3w/vpvs85311y7220v_grhz7y940000gn/T/pip-install-m3lb3nv6/twisted/setup.py'"'"'; __file__='"'"'/private/var/folders/3w/vpvs85311y7220v_grhz7y940000gn/T/pip-install-m3lb3nv6/twisted/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/3w/vpvs85311y7220v_grhz7y940000gn/T/pip-wheel-io9a11t0
cwd: /private/var/folders/3w/vpvs85311y7220v_grhz7y940000gn/T/pip-install-m3lb3nv6/twisted/

Related

Build tensorflow: name 'json' is not defined

When building tensorflow from sources with bazel I have got error:
io_bazel_rules_go/go/private/sdk.bzl:337:12: name 'json' is not defined
How to add the dependency or import json library?
The code looks like python source, so I have tried to import json, which does not work.
clone tensorflow repo:
git clone https://github.com/tensorflow/tensorflow.git
configure
PYTHON_VERSION=python3.10
PYTHON_BIN_PATH=$(which $PYTHON_VERSION) \
PYTHON_LIB_PATH=$($PYTHON_VERSION -c "import pip; print(pip.__path__[0].rstrip('/pip'))") \
TF_NEED_CUDA=0 \
TF_NEED_ROCM=0 \
TF_DOWNLOAD_CLANG=0 \
CC_OPT_FLAGS="-march=native -Wno-sign-compare -mnoavx" \
TF_SET_ANDROID_WORKSPACE=0 \
TF_ENABLE_XLA=1 \
TF_NEED_OPENCL_SYCL=0 \
TF_NEED_MPI=0 \
./configure
and build
bazel build
My environment:
Ubuntu 22.04 LTS (all installed packages are up-to-date)
bazel 3.5.1- (#non-git)
tensorflow branch r2.11
As stated above, 3.5 is too old.
sudo dpkg -P bazel-bootstrap
sudo npm install -g #bazel/bazelisk

Python is not recognized in the VSC integrated terminal

Environment data
VS Code version: 1.47.3
Extension version (available under the Extensions sidebar): XXX
OS and version: Windows Server 2019
Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.8 and Python 3.8.4 (downloaded from Python.org)
Type of virtual environment used (N/A | venv | virtualenv | conda | ...): NA
Relevant/affected Python packages and their versions:
Relevant/affected Python-related VS Code extensions and their versions: Python 2020.7.96456 and Shell launcher 0.4.1
Value of the python.languageServer setting: None
Expected behaviour
When I select the Python Interpreter version, I expect to get the selected version in the VSC integrated terminal.
Actual behaviour
When I type Python in the integrated terminal, the command is not recognized.
In my user settings, I'm setting the PATH environment variable (I removed the path for the python directory here). Also I'm excluding myself from the A/B pythonPath testing.
Steps to reproduce:
Logs
Output from Python output channel
> conda --version
> pyenv root
> python3.7 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.7 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3.6 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -3 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> py -2 c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> ~\AppData\Local\Programs\Python\Python38\python.exe c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> ~\anaconda3\Scripts\conda.exe info --json
Starting Pylance language server.
Python interpreter path: ~\AppData\Local\Programs\Python\Python38\python.exe
Error 2020-08-06 14:59:13: Attempted to download with skipDownload true.
> ~\AppData\Local\Programs\Python\Python38\python.exe c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import jupyter"
> ~\AppData\Local\Programs\Python\Python38\python.exe c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import jupyter"
> ~\AppData\Local\Programs\Python\Python38\python.exe c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import notebook"
> ~\AppData\Local\Programs\Python\Python38\python.exe c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py -c "import notebook"
Error 2020-08-06 14:59:16: Detection of Python Interpreter for Command py and args -2 failed as file Python 2 not found!
-3.8-64
-3.7-64 does not exist
Error 2020-08-06 14:59:16: Detection of Python Interpreter for Command py and args -3.6 failed as file Python 3.6 not found!
-3.8-64
-3.7-64 does not exist
> ~\anaconda3\Scripts\conda.exe info --json
> ~\anaconda3\Scripts\conda.exe env list
> ~\AppData\Local\Programs\Python\Python37\python.exe c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py pip --version
Python interpreter path: ~\AppData\Local\Programs\Python\Python37\python.exe
> ~\AppData\Local\Programs\Python\Python38\python.exe c:\Users\el.mehdi.el.aouni\.vscode\extensions\ms-python.python-2020.7.96456\pythonFiles\pyvsc-run-isolated.py pip --version
Editor support is inactive since language server is set to None.
Python interpreter path: ~\AppData\Local\Programs\Python\Python38\python.exe
There is an explanation here:
https://github.com/microsoft/vscode-python/issues/13327

How do I install a module (RDKIT) permanently in Colab

How do I install a library permanently in Colab?
I followed the accepted answer from this thread
How do I install a library permanently in Colab?
# first install gcsfuse
%%capture
!echo "deb http://packages.cloud.google.com/apt gcsfuse-bionic main" > /etc/apt/sources.list.d/gcsfuse.list
!curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
!apt update
!apt install gcsfuse
%%writefile /key.json
{
"type": "service_account",
"project_id": "kora-id",
"private_key_id": "xxxxxxx",
"private_key": "-----BEGIN PRIVATE KEY-----\nxxxxxxx==\n-----END PRIVATE KEY-----\n",
"client_email": "colab-7#kora-id.iam.gserviceaccount.com",
"client_id": "100380920993833371482",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/colab-7%40kora-id.iam.gserviceaccount.com"
}
%env GOOGLE_APPLICATION_CREDENTIALS=/key.json
!mkdir /content/my-bucket
!gcsfuse my-bucket /content/my-bucket
import sys
nb_path = '/content/my-bucket'
sys.path.insert(0, nb_path)
# Do this just once
!pip install --target=$nb_path jdc
RDKIT installation I followed https://www.youtube.com/watch?v=ERvUf_lNopo
# Install RDKit. Takes 2-3 minutes
!wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!time bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
!time conda install -q -y -c anaconda python=3.7
!time conda install -q -y -c conda-forge rdkit
You can use this code, which avoid conda and can install rdkit in 6 seconds
url = 'https://anaconda.org/rdkit/rdkit/2018.09.1.0/download/linux-64/rdkit-2018.09.1.0-py36h71b666b_1.tar.bz2'
!curl -L $url | tar xj lib
!mv lib/python3.6/site-packages/rdkit /usr/local/lib/python3.6/dist-packages/
x86 = '/usr/lib/x86_64-linux-gnu'
!mv lib/*.so.* $x86/
!ln -s $x86/libboost_python3-py36.so.1.65.1 $x86/libboost_python3.so.1.65.1
Update: I made a custom tarball that we can just extract them. Taking only 1.7s to install
!curl -L bit.ly/rdkit-colab | tar xz -C /
You can also use my kora library.
!pip install kora
import kora.install.rdkit

Error while installing numpy in alpine image

Error :
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-install-2u_c2pqi/numpy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-gfsn5nsl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-2u_c2pqi/numpy/
This is the error I am getting in my travis build of my dockerfile.
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
24 && apk --no-cache --update-cache add postgresql-dev musl-dev linux-headers g++ gfortran py-pip build-base bash libpng-dev openblas-dev w get freetype-dev gcc \
25 && ln -s /usr/include/locale.h /usr/include/xlocale.h \
26 && pip3 install setuptools wheel \
27 && pip3 install numpy pyyaml`
I am installing numpy using the above commands
Some issues have been found in your Dockerfile:
python3-dev and py3-pip packages should be installed to install numpy.
g++ already has gcc and musl-dev in dependencies, so we can simplify a package list.
The final Dockerfile is:
FROM alpine:latest
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk --no-cache --update-cache add postgresql-dev g++ linux-headers gfortran build-base bash libpng-dev openblas-dev wget freetype-dev python3-dev py3-pip \
&& ln -s /usr/include/locale.h /usr/include/xlocale.h \
&& pip3 install setuptools wheel \
&& pip3 install numpy pyyaml

using homebrew apxs from homebrew apache httpd24 fails with libtool: compile: unable to infer tagged configuration

using homebrew apxs from homebrew apache httpd24 fails with libtool: compile: unable to infer tagged configuration
$ apxs -i -c -Wc,"-arch x86_64" -Wl,"-arch x86_64 " mod_uwsgi.c
/usr/share/apr-1/build-1/libtool --silent --mode=compile cc -prefer-pic -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/Cellar/httpd24/2.4.3/include/apache2 -I/usr/include/apr-1 -I/usr/include/apr-1 -arch x86_64 -c -o mod_uwsgi.lo mod_uwsgi.c && touch mod_uwsgi.slo
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
apxs:Error: Command failed with rc=65536
.
What environment must I export to have libtool not complain about tag?
after digging through the source I found that if LTFLAGS is set to --tag=cc things work.
$ LTFLAGS=--tag=cc apxs -i -c mod_uwsgi.c