LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2024, 09:38 AM   #16
piotrbujakowski
Member
 
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47

Original Poster
Rep: Reputation: 1

I do that.
Configure.
Nothing change.

Quote:
Originally Posted by NevemTeve View Post
Use bash command `set +H` to prevent `!` being handled specially.
 
1 members found this post helpful.
Old 07-02-2024, 12:24 PM   #17
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,639

Rep: Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525
instead of
Code:
echo $(python3 -c "import vosk; print('Vosk successfully imported!')")
just write
Code:
python3 -c "import vosk; print('Vosk successfully imported!')"
But anyway it is already there, "Vosk successfully imported!" was printed.
 
Old 07-02-2024, 03:13 PM   #18
piotrbujakowski
Member
 
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47

Original Poster
Rep: Reputation: 1
That is strange, a problem.

Code:
echo $(python3 -c "import vosk; print('Vosk successfully imported!')")
bash: !': event not found

python3 -c "import vosk; print('Vosk successfully imported!')"
bash: !': event not found
Code:
Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.

= RESTART: /home/peter/python/ai_neural_brain_2/engine_brain_2_11_neurons_group_and_synapses_talking.py
ERROR      Brian 2 encountered an unexpected error. If you think this is a bug in Brian 2, please report this issue either to the discourse forum at <http://brian.discourse.group/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: /tmp/brian_debug_jxr4b75v.log  Additionally, you can also include a copy of the script that was run, available at: /tmp/brian_script_cn4khhht.py Thanks! [brian2]
Traceback (most recent call last):
  File "/usr/lib/python3.12/idlelib/run.py", line 580, in runcode
    exec(code, self.locals)
  File "/home/peter/python/ai_neural_brain_2/engine_brain_2_11_neurons_group_and_synapses_talking.py", line 6, in <module>
    import vosk
ModuleNotFoundError: No module named 'vosk'

Last edited by piotrbujakowski; 07-02-2024 at 04:42 PM.
 
Old 07-02-2024, 03:26 PM   #19
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
Blog Entries: 1

Rep: Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885
Quote:
I do that.
Configure.
Nothing change.
Please try it again.
Configure.
Here is an example.
Code:
$ set -H
$ echo "print('Hello, World!')" | python3
-bash: !': event not found
$ set +H
$ echo "print('Hello, World!')" | python3
Hello, World!
PS: make sure to use [code] tag, not [quote] tag.

Last edited by NevemTeve; 07-02-2024 at 03:29 PM.
 
Old 07-02-2024, 04:30 PM   #20
piotrbujakowski
Member
 
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47

Original Poster
Rep: Reputation: 1
Look like that.

Still error in code.

Code:
set -H
echo "print('Hello, World!')" | python3
bash: !': event not found
set +H
echo "print('Hello, World!')" | python3
Hello, World!

Last edited by piotrbujakowski; 07-02-2024 at 04:31 PM.
 
Old 07-02-2024, 10:14 PM   #21
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
Blog Entries: 1

Rep: Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885
Please examine the lines you inserted: no error in the second half where `set +H` is used.
 
Old 07-03-2024, 12:48 AM   #22
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,639

Rep: Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525
it is the incorrect usage of " and '. For example in post #14
Code:
peter@peter-ThinkPad-P51:~$ source /home/peter/venv/bin/activate
(venv) peter@peter-ThinkPad-P51:~$ source /home/peter/venv/bin/activate
(venv) peter@peter-ThinkPad-P51:~$ python3 -c "import vosk; print('Vosk successfully imported!')"
bash: !': event not found
(venv) peter@peter-ThinkPad-P51:~$ echo $(python3 -c "import vosk; print('Vosk successfully imported!')")
bash: !': event not found
bash: !': event not found
bash: !': event not found
(venv) peter@peter-ThinkPad-P51:~$ echo $(python3 -c "import vosk; print('Vosk successfully imported!')")
bash: !': event not found
(venv) peter@peter-ThinkPad-P51:~$ python3 -c "import vosk; print('Vosk successfully imported!')
bash: !': event not found
(venv) peter@peter-ThinkPad-P51:~$ echo $(python3 -c 'import vosk; print("Vosk successfully imported!")')
Vosk successfully imported!
(venv) peter@peter-ThinkPad-P51:~$
Only the last one was working properly, all the previous attempts failed because of incorrect quotation. I understand it is not really straightforward, and can confuse people.
( ) ! have special meanings in shell, and in your case you need to use them as a regular char or string.
 
Old 07-03-2024, 01:13 AM   #23
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
Blog Entries: 1

Rep: Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885
Note: `set +H` could directly go into `~/.bashrc`.

Edit: not tested yet, but perhaps 'single quotes' prevents !events, while "double quotes" do not.

If so it is, the first should work, the second might fail:
Code:
echo 'We are single quoted here!'
echo "We are double quoted here!"
Mind you, single quotes within double quotes (or vice versa) have no special meaning (also they don't have to come in pairs).
Code:
echo '"This is single quoted too'
echo "'This is double quoted too"

Last edited by NevemTeve; 07-03-2024 at 03:46 AM.
 
Old 07-03-2024, 02:39 PM   #24
piotrbujakowski
Member
 
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47

Original Poster
Rep: Reputation: 1
I have 2 catalogs:
- myenvy
- venv

I make back.

I copied both to self without replace and with replace.

Nothing change.

Is that same.

Code:
I make that again.
sudo chmod 775 -R /home/peter/venv/*
sudo chmod 775 -R /home/peter/venv/
sudo chmod +x -R /home/peter/venv/
sudo chmod +x -R /home/peter/venv/*
sudo chown peter -R /home/peter/venv/*
sudo chown peter -R /home/peter/venv/

sudo chmod 775 -R /home/peter/myenv/*
sudo chmod 775 -R /home/peter/myenv/
sudo chmod +x -R /home/peter/myenv/
sudo chmod +x -R /home/peter/myenv/*
sudo chown peter -R /home/peter/myenv/*
sudo chown peter -R /home/peter/myenv/
Code:
echo 'We are single quoted here!'
We are single quoted here!

echo "We are double quoted here!"
We are double quoted here!
Quote:
Originally Posted by NevemTeve View Post
Note: `set +H` could directly go into `~/.bashrc`.

Edit: not tested yet, but perhaps 'single quotes' prevents !events, while "double quotes" do not.

If so it is, the first should work, the second might fail:

Code:
echo 'We are single quoted here!'
echo "We are double quoted here!"
Mind you, single quotes within double quotes (or vice versa) have no special meaning (also they don't have to come in pairs).
Code:
echo '"This is single quoted too'
echo "'This is double quoted too"

Last edited by piotrbujakowski; 07-03-2024 at 02:46 PM.
 
Old 07-03-2024, 02:43 PM   #25
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
Blog Entries: 1

Rep: Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885
Okay, I'll write this very slowly, to make it easy to undertand:

Do use command set +H e.g.:
Code:
source /home/peter/venv/bin/activate
set +H
python3 -c "import vosk; print('Vosk successfully imported!')"

Last edited by NevemTeve; 07-03-2024 at 02:44 PM.
 
Old 07-03-2024, 02:51 PM   #26
piotrbujakowski
Member
 
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47

Original Poster
Rep: Reputation: 1
I do that.

Code:
source /home/peter/venv/bin/activate
(venv) set +H
(venv) python3 -c "import vosk; print('Vosk successfully imported!')"
Vosk successfully imported!
Code:
Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.

= RESTART: /home/peter/python/ai_neural_brain_2/engine_brain_2_11_neurons_group_and_synapses_talking.py
ERROR      Brian 2 encountered an unexpected error. If you think this is a bug in Brian 2, please report this issue either to the discourse forum at <http://brian.discourse.group/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: /tmp/brian_debug_uz8y80a6.log  Additionally, you can also include a copy of the script that was run, available at: /tmp/brian_script_ljf4rcu6.py Thanks! [brian2]
Traceback (most recent call last):
  File "/usr/lib/python3.12/idlelib/run.py", line 580, in runcode
    exec(code, self.locals)
  File "/home/peter/python/ai_neural_brain_2/engine_brain_2_11_neurons_group_and_synapses_talking.py", line 6, in <module>
    import vosk
ModuleNotFoundError: No module named 'vosk'
 
Old 07-03-2024, 03:28 PM   #27
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
Blog Entries: 1

Rep: Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885Reputation: 1885
Regarding the error message: did it just appear out of blue sky, or you had done something before it?
 
Old 07-04-2024, 01:54 AM   #28
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,639

Rep: Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525Reputation: 7525
I think it is still the same issue again, you installed it using apt as a system-wide python module but you have started a venv and wanted to use it inside. You need to choose either this or that, but you cannot mix them.
If you have a venv, activate it and use pip install to install a module into it. Not as root, but as regular user.
 
Old 07-04-2024, 05:41 AM   #29
piotrbujakowski
Member
 
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47

Original Poster
Rep: Reputation: 1
No always Python, see modules installed using apt.
Then I need instal using pip or pipx.
 
Old 07-05-2024, 03:44 AM   #30
piotrbujakowski
Member
 
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47

Original Poster
Rep: Reputation: 1
So how fix that?

PS.

With Kaldi is a problem too.
I fight whole day without AI Chat Bot.
Everything from GitHub don't works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I got error while installing python-tk python-psycopg2 python-twisted saili kadam Linux - Newbie 1 09-05-2015 03:03 AM
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM
Errors, Errors, and more Errors (KDE 3.4.x GUI Errors) Dralnu Linux - Software 2 05-13-2006 08:30 AM
errors,errors,errors!!! randell6564 Mandriva 2 01-15-2006 02:29 AM
Grub errors...grub errors...grub errors smattmac Linux - Newbie 1 06-13-2005 02:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration