Linux mint program with python

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Linux mint program with python

Post by secretsquirrel9257 »

Hello Everyone, so I have been using Linux mint for a while and other Linux distros for even longer. Thankful to be out of windows OS. So far I've been able to do everything I want through Linux without any setbacks not having windows which is awesome.
Now I am trying to get into programming, and it is not very easy. The hardest part seems to be making my environment fit for programming.

So here is my question, I wanted to try to make an AI assistant with python. I've looked up many different ways to do so and I think my issue is getting the path right for python, what I did was basically copy my files from /home/ssquirrel/.local/bin and /python.
I also am having issues with getting packages like pyaudio. Is there other distros better suited for this? Does anyone have something to add here to help me out? Thank you for your support and keep in mind I am a newbie.
Last edited by LockBot on Tue Nov 28, 2023 11:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
spamegg
Level 14
Level 14
Posts: 5108
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Linux mint program with python

Post by spamegg »

Hello secretsquirrel9257 welcome to the Forum.

Please tell us about your Mint version, desktop etc. because the Python version depends on the base Ubuntu version.

Do not use your system-wide Python installation for programming, because there is a risk of breaking your system if you install system-wide Python packages with pip, or if you install alternate Python versions (either from a PPA or from source).

This applies to any Ubuntu-based distro, and in general any distro where the functioning of the OS depends on the Python version and packages that comes preinstalled with that OS.

I made a tutorial to safely install Python that is separate from the system, and use it for programming.
viewtopic.php?f=42&p=2103213

I remember someone else having issues with pyaudio in the past, it was due to the maintainers (from MIT? I think) having a broken version. Do tell us what your issue is.
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

hello spamegg,
I appreciate your response. i attatched a screen shot of my sys info.
I understand what your saying with pip as far as application, I am not sure the technical side of it. I assume I would use apt-get install then. I am also unsure as to when to put the new python file. I actually already did break the system so i understand why now. thank goodness for timeshift. other than that I built this computer myself and installed linux mint. not my first time, I also did this in many virtual boxes with kali linux and i installed mint on an older laptop. Thanks for the video. I am going to use another timeshift save, and then set it up corectly. thanks a bunch. anything else you think of i would appreciate. I am going to look into the pyaudio issue. Im not sure about the MIT being broke but I am prepared to chase that rabbit. I believe the error code in visual studio code was AttributeError: module 'pyaudio' has no attribute '__version__'. I thought this had to do with path because when i would copy from the main python file and put into the folder that was open in VSC, it would work until another module was not present which I would copy another file in python. probably sounds stupid to you but i could not figure out how to install python again but into a different path and location.
Screenshot from 2023-05-28 18-24-34.png
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

I just restored an older save from timeshift, afterwards I'm going to follow your walkthrough for python. I appreciate this again
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

ok so i did all the steps,

im assuming i can use pip inside the VSC command line as it is coming from the pyenv path however i got this message which is why i started to copy files in the first place.

WARNING: The script normalizer is installed in '/home/jared/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

not sure if i did something wrong here
User avatar
spamegg
Level 14
Level 14
Posts: 5108
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Linux mint program with python

Post by spamegg »

secretsquirrel9257 wrote: Sun May 28, 2023 8:11 pm ok so i did all the steps,

im assuming i can use pip inside the VSC command line as it is coming from the pyenv path however i got this message which is why i started to copy files in the first place.

WARNING: The script normalizer is installed in '/home/jared/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

not sure if i did something wrong here
Yes, when PyEnv activates a different Python version inside VSC command line, that will also affect the pip version. It won't be the system-wide pip. Instead it will be the alternate Python version's pip and it will install packages under something like (here I am using 3.12-dev as an example) $HOME/.pyenv/versions/3.12-dev/lib/python3.12/site-packages

For the warning simply add this to your .bashrc file: export PATH=$HOME/.local/bin:$PATH

Manual file copying is usually considered a bad development practice. Gotta figure out how to make things work properly instead of manual workarounds.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Linux mint program with python

Post by rene »

spamegg wrote: Mon May 29, 2023 2:54 am For the warning simply add this to your .bashrc file: export PATH=$HOME/.local/bin:$PATH
Note; you don't have to do that. Both $HOME/bin and $HOME/.local/bin are added to your path by the standard Mint ~/.profile -- iff those directories exist during logon.

In this case the warning message says that indeed ~/.local/bin exists (now) which is then to say that if you're getting this warning in "a system context" you will have just not yet logged out and back in yet after setting things up, so do that. The other possibility is VSC having a context of its own in this sense but you'd then also need/want to fix it in that VSC-specific context.
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

Still having issues

I took these SS to show the terminal is displaying where stuff is being installed to but i want it placed somewhere else. I honestly have no idea what to do

I also took a SS of VSC to show what is popping up when i try to pip insall SpeechRecognition
Screenshot from 2023-05-29 09-27.png
Screenshot from 2023-05-29 09-27.png (8.91 KiB) Viewed 1625 times
Screenshot from 2023-05-29 09-32.png
Screenshot from 2023-05-29 09-32.png (11.42 KiB) Viewed 1625 times
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

Screenshot from 2023-05-29 09-27(2).png
Screenshot from 2023-05-29 09-27(1).png
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

Screenshot from 2023-05-29 09-32(2).png
Hoser Rob
Level 20
Level 20
Posts: 11796
Joined: Sat Dec 15, 2012 8:57 am

Re: Linux mint program with python

Post by Hoser Rob »

secretsquirrel9257 wrote: Sun May 28, 2023 2:49 pm ... I am trying to get into programming, and it is not very easy. ...
You're right, it's not easy. If anyone tries top tell you that is is easy you can very safely assume that they don't have a clue how to actually do it.
... I wanted to try to make an AI assistant with python. ....
I'm not 100% sure that'd be a good first project, it may be better to start with something simpler.
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

I tried doing the below and you can see what comes back. " no setup.py nor pyproject.toml"

Code: Select all

sh-5.1$ pip install SpeechRecognition /home/jared/pyenv
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
Defaulting to user installation because normal site-packages is not writeable
ERROR: Directory '/home/jared/pyenv' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh-5.1$ pip install setup.py /home/jared/pyenv
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
Defaulting to user installation because normal site-packages is not writeable
ERROR: Directory '/home/jared/pyenv' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh-5.1$ ADD requirements.txt ./
   pip install -r requirements.txt --no-deps -t python/lib/python3.6/site-packages/ /home/jared/pyenv
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh: ADD: command not found
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
ERROR: Directory '/home/jared/pyenv' is not installable. Neither 'setup.py' nor 'pyproject.toml' found.
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh-5.1$ ADD requirements.txt ./
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh: ADD: command not found
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh-5.1$ ADD requirements.txt ./ /home/jared/pyenv
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh: ADD: command not found
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh-5.1$ ADD requirements.txt /home/jared/pyenv
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh: ADD: command not found
[408 preload-host-spawn-strategy] Warning: waitpid override ignores groups
sh-5.1$
Last edited by karlchen on Tue May 30, 2023 5:18 am, edited 1 time in total.
Reason: added [code] [/code] tags
User avatar
secretsquirrel9257
Level 1
Level 1
Posts: 9
Joined: Sun May 28, 2023 2:30 pm

Re: Linux mint program with python

Post by secretsquirrel9257 »

thanks Hoser Rob,
I am open to any suggestions. The reason I started there with AI assistant was because I was told this is a simple project... I suppose your right about listening to the internet lol. But now Im at a loss. I would like to try to do something to start learning but idk what and I am still not sure my computer is ready and what I need to do to get it there. most of the scripts seem to be ready and complete. My thought was if i can use someone elses already done project, I could play with it and see how it works... sorta like reverse engineering it. But alas, I cant get it off the ground to start with.
User avatar
spamegg
Level 14
Level 14
Posts: 5108
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Linux mint program with python

Post by spamegg »

From the screenshots it looks like your VSC Terminal is using sh instead of bash. That might be a source of the problems, as the PyEnv tutorial I wrote is for bash only. So sh is probably not aware of .bashrc, and therefore, certain things on PATH.

Go into VSC settings and try to figure out how to make it use bash instead. Here's official documentation: https://code.visualstudio.com/docs/terminal/basics
Hoser Rob
Level 20
Level 20
Posts: 11796
Joined: Sat Dec 15, 2012 8:57 am

Re: Linux mint program with python

Post by Hoser Rob »

secretsquirrel9257 wrote: Mon May 29, 2023 10:00 am thanks Hoser Rob,
I am open to any suggestions. The reason I started there with AI assistant was because I was told this is a simple project... I suppose your right about listening to the internet lol. But now Im at a loss. I would like to try to do something to start learning but idk what and I am still not sure my computer is ready and what I need to do to get it there. most of the scripts seem to be ready and complete. My thought was if i can use someone elses already done project, I could play with it and see how it works... sorta like reverse engineering it. But alas, I cant get it off the ground to start with.
Don't worry about the computer or the software, any bottleneck when learning programming is going to be you.

Find a decent book about python programming, it's a good language for starting out with. I don't know of any that stick out in my mind. But the reason I suggest a book is that for a book to be published by a real publisher, someone else must have thought he or her knows what they';re talking about. On the web, there are gazillions of pages written by people who think they know ehat they're talking about, even if no one else does.
For every complex problem there is an answer that is clear, simple, and wrong - H. L. Mencken
User avatar
AndyMH
Level 21
Level 21
Posts: 13759
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Linux mint program with python

Post by AndyMH »

I started off with this:
https://www.amazon.co.uk/Automate-Borin ... b_title_bk
I have the original version based around python2, the updated version in the link is python3.

It was a good introduction.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
majpooper
Level 8
Level 8
Posts: 2087
Joined: Thu May 09, 2013 1:56 pm
Location: North Carolina, USA

Re: Linux mint program with python

Post by majpooper »

Everybody learns a bit differently so what is starting - albeit slowly - for me may be a non-starter for you.
Yeah, I tried the "Hello World" approach form of instruction on the internet. Maybe if I wasn't a cheapskate some of the instruction from a book or something you pay for would be more effective. But what I found is that I was doing boring exercises that had no real practical application to the things I wanted to do.

Then I started asking AI to convert basic bash scripts that I had written to python. Even though they typically do not always work properly at first I have begun to pick up things in python. And actually the several iterations it takes for AI to finally get the python program to work is very instructive. And because it evolves things that I want to automate it is much more engaging than writing some program that averages sales of widgets or makes a contact list from your input of made up names.

You wouldn't have to start the way I did in converting another program you could just spec out what you wanted to do and ask AI to write a python program to do that operation. It would be rather rough but you could try to see what it did. I think trying to make something work and the repetition is what works for me. I will say at first I didn't understand much but as time goes on I understand a little bit more - understand I am still a raw novice - and a lot of what AI generates is way above my level of understanding. But lately I am actually starting to correct or modify the AI generated python output. The thing I really like is that I can ask a question about the code or what it is doing an immediate explanation.

The BIG push back I have received on the forum is that AI generated scripts are error prone and could be dangerous. That is all true and like any tool AI should be used with a healthy dose of skepticism and common sense. But for me it has been a great learning tool.
Locked

Return to “Beginner Questions”