/usr/bin/sudo: Permission denied in cygwin when installing "libpng-dev" - cygwin

I am getting the error as follows in cygwin
$ make
g++ -O3 -W -Wall -g -c -o ImageIOpng.o ImageIOpng.cpp
ImageIOpng.cpp:19:17: fatal error: png.h: No such file or directory
compilation terminated.
make: *** [<builtin>: ImageIOpng.o] Error 1
After followin to this answer. png.h file not found - Linux,
I had error in the following,
$ sudo apt-get install libpng-dev
-bash: /usr/bin/sudo: Permission denied
I have read that in Linux, I don't need to write sudo, instead of that I can use yum. So, I have tried yum install. But, it says
Traceback (most recent call last):
File "/usr/bin/yum", line 22, in <module>
import yummain
File "/usr/share/yum/yummain.py", line 22, in <module>
import clientStuff
File "/usr/share/yum/clientStuff.py", line 18, in <module>
import rpm
ImportError: No module named rpm
Almost, in every steps, I am getting errors. What was the problem? yum is very useful package, but it seems installed not correctly.I have installed yum-2.0.7.

To install package on cygwin you need to use its setup as downloaded by
https://cygwin.com
see
https://cygwin.com/cygwin-ug-net/setup-net.html#setup-packages
for how to select packages.
yum will not work and please note that Cygwin is not Linux. Most things works in the same way but not all.

Related

What is happening with my python and terminal on ubuntu?

I utilize Ubuntu 20.4 and python3.10, but when I run:
sudo apt-get update or sudo apt update
my terminal show me this code:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFou/?nd.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
When I run: sudo apt-get upgrade no problems happen.
Detail my python3.8 and python3.10 run normally
I don't know what is this.
I ran into same problem today. I did some search via google. Per https://www.linuxquestions.org/questions/linux-software-2/errors-trying-to-run-apt-get-update-4175665017/#3, finally my problem is fixed by followings:
cd /usr/lib/python3/dist-packages
ls -la apt.pkg.*
if apt.pkg.so is no there, copy the one to there.
sudo cp apt_pkg.cpython-38-x86_64-linux-gnu.so apt_pkg.so

Meson Install failed for Libcamera build

I'm having some trouble build libcamera into my Ubuntu machine.
I'm following the instructions, but it fails during ninja -C build install
This is the error:
felipe# ninja -C build install
ninja: Entering directory `build'
[1/2] Installing files.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/mesonbuild/mesonmain.py", line 129, in run
return options.run_func(options)
File "/usr/lib/python3/dist-packages/mesonbuild/minstall.py", line 514, in run
installer.do_install(datafilename)
File "/usr/lib/python3/dist-packages/mesonbuild/minstall.py", line 330, in do_install
d = pickle.load(ifile)
AttributeError: Can't get attribute 'OctalInt' on <module 'mesonbuild.coredata' from '/usr/lib/python3/dist-packages/mesonbuild/coredata.py'>
FAILED: meson-install
/home/felipe/.local/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.
Not sure how to follow from here.
I've tried updating everything, even removing and reinstalling meson but it didn't work.
It looks as possible that you face what is described in the end of instructions (your link) - you have system and local meson installations of different versions, so
If a version of meson which is different from the system-wide version
is already installed, uninstall that meson using pip3, and install
again without the --user argument.
And finally (while writing) I found confirmation of my suspicion here.

ModuleNotFoundError: No module named '_sqlite3'

On Redhat 4.4.7-18 I am trying to run python3 code using sqlite, but I get the following import error:
Traceback (most recent call last):
File "database.py", line 7, in <module>
import sqlite3
File "/usr/local/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
I tried to install it:
>sudo pip install sqlite3
Collecting sqlite3
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(101, 'Network is unreachable'))': /simple/sqlite3/
(while the network is reachable...) and with the following command:
> sudo yum install sqlite-devel
Loaded plugins: post-transaction-actions, product-id, refresh-packagekit,
: rhnplugin, search-disabled-repos, security, subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Install Process
Package sqlite-devel-3.6.20-1.el6_7.2.x86_64 already installed and latest version
Nothing to do
So it is installed and not installed? Any suggestion how I can solve the original problem?
Not a direct answer but I ended up here with my search engine... So for my fellow web-surfers:
I had a similar issue, but on ubuntu 16.04 with a manually compile python3.6 version :
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
I had to install libsqlite3-dev (sudo apt install libsqlite3-dev) and compile from the start python3.6 to make it work.
Yep.
sudo yum install sqlite-devel
Followed by rebuild of Python 3.8.3 from source did the trick. Thx!
I had this issue on linux mint 20 after sqlite3 successfully installed
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
also, could not import sqlite3 into python interpreter
Fix:
sudo apt install libsqlite3-dev
cd your python installer directory
./configure
sudo make install
It happens when you install Python using the source code and then compile.
Usually people tend to install python and sqlite into separate folders. This causes sqlite binary inaccessible to python executables.
To solve this problem, use a common folder to install BOTH, the Python as well as sqlite. So that python binary and sqlite binary, reside in the same bin folder.
Below example script will solve:
INSTALL_BASE_PATH="/home/<user>/<tools>"
cd ~
mkdir build
cd build
[ -f Python-3.9.10.tgz ] || wget --no-check-certificate https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz
tar -zxvf Python-3.9.10.tgz
[ -f sqlite-autoconf-3380000.tar.gz ] || wget --no-check-certificate https://www.sqlite.org/2022/sqlite-autoconf-3380000.tar.gz
tar -zxvf sqlite-autoconf-3380000.tar.gz
cd sqlite-autoconf-3380000
./configure --prefix=${INSTALL_BASE_PATH}
make
make install
cd ../Python-3.9.10
LD_RUN_PATH=${INSTALL_BASE_PATH}/lib configure
LDFLAGS="-L ${INSTALL_BASE_PATH}/lib"
CPPFLAGS="-I ${INSTALL_BASE_PATH}/include"
LD_RUN_PATH=${INSTALL_BASE_PATH}/lib make
./configure --prefix=${INSTALL_BASE_PATH}
make
make install
cd ~
LINE_TO_ADD="export PATH=${INSTALL_BASE_PATH}/bin:\$PATH"
if grep -q -v "${LINE_TO_ADD}" $HOME/.bashrc; then echo "${LINE_TO_ADD}" >> $HOME/.bashrc; fi
LINE_TO_ADD="export LD_LIBRARY_PATH=${INSTALL_BASE_PATH}/lib"
if grep -q -v "${LINE_TO_ADD}" $HOME/.bashrc; then echo "${LINE_TO_ADD}" >> $HOME/.bashrc; fi
source $HOME/.bashrc

dpkg: error processing archive

I got this error when trying to install anything on ubuntu 16.04.
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-
samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
/var/cache/apt/archives/python-libxml2_2.9.3+dfsg1-1ubuntu0.2_amd64.deb
/var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb
N: Ignoring file '50unattended-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Sub-process /usr/bin/dpkg returned an error code (1)
I have tried apt-get -f install but it shows the same error . could anyone help ?
After a while in searching , i have fixed the problem with those lines in terminal:
$ sudo apt-get clean
$ sudo apt-get update
$ sudo apt-get install --reinstall python-minimal python-lockfile
$ sudo apt-get -f install
For a generic approach on how to deal with the issue stated in this question's header, also check answers of this question
the following fixed my issue
sudo dpkg -P <program>
To fix this problem, please check your Python versions.
Insert command:
update-alternatives --config python
Then enable version 2.7.
Now check.

Installing phpsh on linux, Python error

I'm trying to install phpsh on Ubuntu and I did everything on the install guide, but I am getting this error:
Starting php
Traceback (most recent call last):
File "/usr/local/bin/phpsh", line 47, in <module>
verbose=opts.verbose)
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 503, in __init__
self.php_open_and_check()
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 641, in php_open_and_check
self.php_open()
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 698, in php_open
preexec_fn=os.setsid)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Why am I getting these errors? How do I install phpsh on linux?
Open ~/.bashrc from the terminal using:
linux#terminal:vi ~/.bashrc
set PYTHONPATH and path in there:
export PYTHONPATH=~/lib/python2.6/site-packages
//Put the above value as your site-packages directory location,
//yours may have a different python version number.
Then add ~/bin to your PATH as well as per your directory structure.
Walkthrough on installing phpsh on linux
The phpsh install guide at (http://www.phpsh.org/) site only gives you part of the details to get this up and running on linux.
The Gotchas:
phpsh won't run on your system if you don't have PHP configured properly.
phpsh won't run correctly if you don't have python configured properly.
If gcc is not properly setup, then phpsh will not install correctly.
You may need the python development headers for phpsh to work.
Here are all the specific steps I did to install phpsh on a Fedora 17 box
cd /home/el
sudo yum install php
sudo yum install php-posix
sudo yum install python
sudo yum install python-devel
git clone git://github.com/facebook/phpsh.git
cd /home/el/phpsh
sudo easy_install readline
python setup.py build
sudo python setup.py install
Open up your /home/el/.bashrc in an editor and add this line at the bottom:
export PYTHONPATH="/home/el/lib/python2.7/site-packages"
Make sure that the directory exists before you paste it in there. You may have to change the python2.7 to a different number to reflect your actual version. Restart the terminal.
Then, FINALLY, it runs as advertised:
el#defiant ~ $ phpsh
Starting php
php> echo "sweet lady freedom lets make out! " . 1337;
sweet lady freedom lets make out! 1337
php>
Then see my post to take a test drive of this tool: How to use the PHP interactive shell
Notes if you are adapting this to other flavors of Linux
You may have to use python-dev instead of python-devel.
I was also getting this issue last day as I am a new learner of PHP. At last I figured out problems.
You must need to install php5-cli from apt-get before installing phpsh.
Also keep in mind that required python packages should also be installed. For that go to https://github.com/facebookarchive/phpsh.
I assume you already have python and you are using Ubuntu 14.04 or above. While installing the python packages you may get some other errors, as it may require you to install easy-install etc. But don't worry, you will get very verbose errors that will tell you exactly what to do.
Hope this solves your problem.
Sooooooooooooooooo I had this problem too.
phpsh is checking for php on your system & not finding it.
$ sudo apt-get install php5
This is partially a matter of poor logging. See the lines in the Traceback:
File "/usr/local/lib/python2.7/dist-packages/phpsh/__init__.py",
line 641, in php_open_and_check
self.php_open()
The kicker was that I tried sudo apt-get install php which now obviously didn't work, but for some reason I didn't keep at it!

Resources