ERROR: Failed building wheel for ujson while installing rasa x using pip

I am getting an Error while installing rasa x using pip pip version- 20.1.1 python version - 3.6 OS: ubuntu 20.04

ERROR: Failed building wheel for ujson.

Building wheels for collected packages: ujson Building wheel for ujson (setup.py) … error ERROR: Command errored out with exit status 1: command: /home/vitwit/teja/machine_learning_projects/rasa/venv/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-4l9hduo1/ujson/setup.py’"’"’; file=’"’"’/tmp/pip-install-4l9hduo1/ujson/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 /tmp/pip-wheel-pder3p70 cwd: /tmp/pip-install-4l9hduo1/ujson/ Complete output (15 lines): running bdist_wheel running build running build_ext building ‘ujson’ extension creating build creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/python creating build/temp.linux-x86_64-3.6/lib x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fdebug-prefix-map=/build/python3.6-_AWkrw/python3.6-3.6.11=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/home/vitwit/teja/machine_learning_projects/rasa/venv/include -I/usr/include/python3.6m -c ./python/ujson.c -o build/temp.linux-x86_64-3.6/./python/ujson.o -D_GNU_SOURCE In file included from ./python/ujson.c:39: ./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory 39 | #include <Python.h> | ^~~~~~~~~~ compilation terminated. error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1

ERROR: Failed building wheel for ujson Running setup.py clean for ujson Failed to build ujson Installing collected packages: ujson, rasa-x Attempting uninstall: ujson Found existing installation: ujson 2.0.3 Uninstalling ujson-2.0.3: Successfully uninstalled ujson-2.0.3 Running setup.py install for ujson … error ERROR: Command errored out with exit status 1: command: /home/vitwit/teja/machine_learning_projects/rasa/venv/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-4l9hduo1/ujson/setup.py’"’"’; file=’"’"’/tmp/pip-install-4l9hduo1/ujson/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-cnluj4rh/install-record.txt --single-version-externally-managed --compile --install-headers /home/vitwit/teja/machine_learning_projects/rasa/venv/include/site/python3.6/ujson cwd: /tmp/pip-install-4l9hduo1/ujson/ Complete output (15 lines): running install running build running build_ext building ‘ujson’ extension creating build creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/python creating build/temp.linux-x86_64-3.6/lib x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fdebug-prefix-map=/build/python3.6-_AWkrw/python3.6-3.6.11=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python -I./lib -I/home/vitwit/teja/machine_learning_projects/rasa/venv/include -I/usr/include/python3.6m -c ./python/ujson.c -o build/temp.linux-x86_64-3.6/./python/ujson.o -D_GNU_SOURCE In file included from ./python/ujson.c:39: ./python/py_defines.h:39:10: fatal error: Python.h: No such file or directory 39 | #include <Python.h> | ^~~~~~~~~~ compilation terminated. error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1 ---------------------------------------- Rolling back uninstall of ujson Moving to /home/vitwit/teja/machine_learning_projects/rasa/venv/lib/python3.6/site-packages/ujson-2.0.3.dist-info/ from /home/vitwit/teja/machine_learning_projects/rasa/venv/lib/python3.6/site-packages/~json-2.0.3.dist-info Moving to /home/vitwit/teja/machine_learning_projects/rasa/venv/lib/python3.6/site-packages/ujson.cpython-36m-x86_64-linux-gnu.so from /tmp/pip-uninstall-l2b8_10y/ujson.cpython-36m-x86_64-linux-gnu.so ERROR: Command errored out with exit status 1: /home/vitwit/teja/machine_learning_projects/rasa/venv/bin/python -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-4l9hduo1/ujson/setup.py’"’"’; file=’"’"’/tmp/pip-install-4l9hduo1/ujson/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-cnluj4rh/install-record.txt --single-version-externally-managed --compile --install-headers /home/vitwit/teja/machine_learning_projects/rasa/venv/include/site/python3.6/ujson Check the logs for full command output.

I got the same error message…

Hey problem got solved by using Virtual environment create with Conda

Follow the installation process by @rctatman in youtube. Just search rasa installation. Installing Rasa in a virtual environment would work for you.

Hi there I encountered the same issue pertaining to ujson build error. It seems to me only ujson 1.35 is supported and compatible. And pip installing it directly doesn’t seem to work. You can download the wheel file for ujson 1.35 . like mine was ujson-1.35-cp37-cp37m-linux_x86_64.whl here cp37 means my cyptyhon version/ python version which is 3.7.x and x86_64 was compatible for my ubuntu16.04 platform. you can lookup appropriate wheel file accordingly. Then use the following command:

pip3 install ujson-1.35-cp37-cp37m-linux_x86_64.whl then :

pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple pip/pip3 both can be used,

2 Likes

yes i got a solution that no need to create a virutal environment at the earlier on conda.need to install in the base version…just

  1. conda install tensorflow for all the processor(i3,i5,i7)
  2. conda install ujson
  3. pip install rasa Then all done just check with the keyword type “rasa” if its showing the lack of list it means succesfully installed. Then run “rasa init”…it will ask the permision to install the dependencies…give the location path. Then it will train the model itself… close the terminal and try again to create the conda enviroment …after installation…then activate your env name… then run like the above steps. Thank you
1 Like

Hey,

If you are on windows and use anaconda distribution, this might help you .

  1. First create an virtual environment in anaconda prompt using the command : conda create -n rasavirtualenv python = 3.6
  2. Activate your environment using the command : conda activate rasavirtualenv
  3. install ujson 1.35 version using the command: conda install ujson==1.35
  4. Now install rasa x using the command below :

pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple

You can choose any name for your virtual environment as per your liking.

This flow has worked for me. Wish you all the best :blush: