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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
07-02-2024, 09:38 AM
|
#16
|
Member
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47
Original Poster
Rep:
|
I do that.
Configure.
Nothing change.
Quote:
Originally Posted by NevemTeve
Use bash command `set +H` to prevent `!` being handled specially.
|
|
|
1 members found this post helpful.
|
07-02-2024, 12:24 PM
|
#17
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,639
|
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.
|
|
|
07-02-2024, 03:13 PM
|
#18
|
Member
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
07-02-2024, 03:26 PM
|
#19
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
|
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.
|
|
|
07-02-2024, 04:30 PM
|
#20
|
Member
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
07-02-2024, 10:14 PM
|
#21
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
|
Please examine the lines you inserted: no error in the second half where `set +H` is used.
|
|
|
07-03-2024, 12:48 AM
|
#22
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,639
|
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.
|
|
|
07-03-2024, 01:13 AM
|
#23
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
|
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.
|
|
|
07-03-2024, 02:39 PM
|
#24
|
Member
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47
Original Poster
Rep:
|
I have 2 catalogs:
- myenvy
- venv
I make back.
I copied both to self without replace and with replace.
Nothing change.
Is that same.
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
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.
|
|
|
07-03-2024, 02:43 PM
|
#25
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
|
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.
|
|
|
07-03-2024, 02:51 PM
|
#26
|
Member
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47
Original Poster
Rep:
|
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'
|
|
|
07-03-2024, 03:28 PM
|
#27
|
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,923
|
Regarding the error message: did it just appear out of blue sky, or you had done something before it?
|
|
|
07-04-2024, 01:54 AM
|
#28
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,639
|
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.
|
|
|
07-04-2024, 05:41 AM
|
#29
|
Member
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47
Original Poster
Rep:
|
No always Python, see modules installed using apt.
Then I need instal using pip or pipx.
|
|
|
07-05-2024, 03:44 AM
|
#30
|
Member
Registered: Jan 2017
Location: London, UK
Distribution: Ubuntu
Posts: 47
Original Poster
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 03:38 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|