Help! - ModuleNotFoundError: No module named 'distutils'

You need a requirements.txt file with at least this content:

scikit-learn
streamlit

I already have that contents in ‘requirements.txt’
scikit-learn
streamlit

And I updated numpy version to 1.26 and 2.0,
It makes another error…

I keep seeing numpy==1.25.2 in your requirements file.

Now I working in
github repo : KB_HRD_Chatbot_2/
(I cannot write URL…, my post has hidden…)

(another repo…)

plz confirm above URL
(I’m fixing with advice of ChatGPT)

I tried to deploy your code and got this:

Collecting onnx==1.14.1 (from -r /mount/src/kb_hrd_chatbot_2/requirements.txt (line 118))
  Downloading onnx-1.14.1.tar.gz (11.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 11.3/11.3 MB 222.6 MB/s eta 0:00:00[2024-08-21 12:52:56.401205] 
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      <string>:33: DeprecationWarning: Use shutil.which instead of find_executable
      <string>:34: DeprecationWarning: Use shutil.which instead of find_executable
      fatal: not a git repository (or any of the parent directories): .git
      Traceback (most recent call last):
        File "/home/adminuser/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/adminuser/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/adminuser/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-vp8pz76w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-vp8pz76w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-vp8pz76w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 502, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-vp8pz76w/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 85, in <module>
      AssertionError: Could not find cmake executable!
      [end of output]  

Again, onnx==1.14.1 is too old for python 3.12.

Thanks,
what version I must install? (onnx)

If you don’t have a good reason to install a specific version, then do not specify a version.

Finally…

I success deploy the app…

Thank you very much…much…

Thank you for your patience…

Thanks to your good information, I successfully distributed the app, but another problem occurred.

At the time of coding, I wanted to make a chatbot that learns one specific “file” (without uploading it directly by the user), users only ask questions, and AI does not put a file in gitignore, so it seems that this file cannot be read in the distributed app.

I’m trying to solve this problem.

Anyway, I succeeded in distributing the app. Thank you.

I don’t understand your issue. It is up to you what files to put in .gitignore. You don’t need to delegate that to an AI. Anyway, not putting the file in .gitignore looks ike the right thing to do in your case.

I mean that I want to make an app that already learned a file(pre-learned). The app don’t need to ask to upload a file from users. But the file is secret file, so it cannot be upload open source platform like github.

So I am studying to making a app like that.

You can have the file in a private github repo or any other service that allows private file hosting.

I try like that… But my app cannot get the path…

Since it is private, you’ll need some form of authentication, maybe by means of an authentication token. You should be able to find out the details in the Internet.

I’m trying to hard…but it is so difficult…^^

I got my PAT, but I must learn & study more… for deploy my app.

More options that may or may not work for your specific needs:

  • Host the file publicly but encrypted. You only need to keep secret the key.
  • Ask yourself: what bad things would happen if other people could get the file? Maybe it’s not worth all the hassle, after all.
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (pyproject.toml): started
  Building wheel for pyaudio (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  
  × Building wheel for pyaudio (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/pyaudio
      copying src/pyaudio/__init__.py -> build/lib.linux-x86_64-cpython-312/pyaudio
      running build_ext
      building 'pyaudio._portaudio' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/src
      creating build/temp.linux-x86_64-cpython-312/src/pyaudio
      gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include -I/usr/include -I/home/adminuser/venv/include -I/usr/local/include/python3.12 -c src/pyaudio/device_api.c -o build/temp.linux-x86_64-cpython-312/src/pyaudio/device_api.o
      src/pyaudio/device_api.c:9:10: fatal error: portaudio.h: No such file or directory
          9 | #include "portaudio.h"
            |          ^~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: pip install --upgrade pip
Checking if Streamlit is installed
Found Streamlit version 1.38.0 in the environment

``` i try it but i still have the same problem

I ran into the same node module not found Dist issue. Upgrading numpy from 1.25 to 2.0 fixed the issue thankyou for creating this thread and Goyo thank you for the info.

This is the fix

After weeks in investigating this, I finally got the solution…

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8-distutils
#You can specify your default python version instead of 3.8
sudo apt-get install python3-apt

It worked for me, thanks!