I have an issue to install python-tk package for my app to user's computer. User does not have sudo rights, but has python installed by default.
I can't even find downloadable python-tk module to simply run "python setup.py install" .
Can someone help with this? Are there any other choices?
Unfortunately, python-tk is actually a separately-packaged version of Tkinter, built straight from the Python source code; it's not a separately available source package.
What you can do is build and install your own version of Python in your homedir.
Related
I tried to run a script with python, it has taichi package downloaded from GitHub.
I have little knowledge of how python packages are installed, now I got error in command prompt like
"ModuleNotFoundError: No module named 'taichi'"
I just installed package downloaded from GitHub: https://pypi.org/project/taichi/#files
Hope someone can teach what should I do to run my script contains taichi package~
To install packages in python you just run the command pip install (name of package) in the command prompt so in your case that would be pip install taichi
How to install virtualenv:
Install pip first
sudo apt-get install python3-pip
Then install virtualenv using pip3
sudo pip3 install virtualenv
Now create a virtual environment
virtualenv venv
Active your virtual environment:
source venv/bin/activate
Now install your package for python
pip3 install taichi
I have figured it our that this Taichi package needs 64 bits python, it also needs LLMV file downloaded. Besides, there should be virtual studio installed in the local computer.
Then this Taichi package can be installed just by using "pip install taichi" in command.
Thanks for everyone's help!
I alse encountered this problem,I confirmed that I have already successfully installed taichi whereas it still showed "no module named taichi" .And here is my solution:tryimport sysandsys.path to check whether the file of the packages is contained in python's search range.
For example,after I inputsys.path in python ,it shows ['e:\\', 'd:\\anaconda2022\\python39.zip', 'd:\\anaconda2022\\DLLs', 'd:\\anaconda2022\\lib', 'd:\\anaconda2022', '', 'd:\\anaconda2022\\lib\\site-packages', 'd:\\anaconda2022\\lib\\site-packages\\win32', 'd:\\anaconda2022\\lib\\site-packages\\win32\\lib', 'd:\\anaconda2022\\lib\\site-packages\\Pythonwin']
I am using anaconda as the python interpreter in vscode ,so the packages of taichi is installed in d:\\anaconda2022\\lib\\site-packages,and I can import it successfully . But previously my sys.path are incorrectly setted to E:\\Python but not D:\\anaconda2022. Python cannot find the packages of taichi from the wrong sys.path.
Check the sys.path in python may help.If it is the one which cause the problem , there are many ways to edit sys.path .I solved it by uninstalling the python for I installed python and anaconda at the same time (- -).
I would like to use gstreamer library (1.0+) inside my python code. As they mention on their website they offer python bindings, but unfortunately they do not provide any additional information on how to get it up and running.
Can someone please provide a step by step instructions on how to install all the required package (preferably with pip) in order to use gstreamer inside a python virtual environment. A minimal working example would also be highly appreciated.
ps: I am working on Ububtu 18.04
In order to use gstreamer with python bindings a PyGObject package must be installed.
The setup procedure is the following:
Open a terminal and enter your virtual environment
Execute sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0 to install the build dependencies and GTK
Execute pip3 install pycairo to build and install Pycairo
Execute pip3 install PyGObject to build and install PyGObject
A more comprehensive guide can be found here:
https://pygobject.readthedocs.io/en/latest/getting_started.html
Check their examples:
https://gitlab.freedesktop.org/gstreamer/gst-python/-/tree/master/examples
Everything to get started should be in there.
I was trying to install Django. Turns out that course's teacher said that we will be working with Python 3.6
I install Python 3.6. Now it's my default, it somewhat replaced the last version I had; which is Python 3.5.
Everything ok until that. But when I want to install Django doing
"pip3 install django", it tells me that the module is already satisfied and therefore installed.
I run "python3" command into my terminal. It runs Python 3.6. I try to import Django, and boom... "No module named 'django'".
Then I realized pip3 was actually installing my modules into Python 3.5 and not 3.6. So what I do is to install pip in Python 3.6.
I download get-pip.py and proceed to execute it with Python 3.6 typing in "python3.6 get-pip.py".
Here is when the damn "zipimport.ZipImportError: can't decompress data; zlib not available" goes in. I've tried a ton of things and no one of them fixed the %^$! problem. I'm really tired.
What I have already tried:
python3.6 -m pip install django, which output is "/usr/local/bin/python3.6: No module named pip"
apt install zlib, which output is "E: Unable to locate package zlib"
apt install zlib1g-dev, which says that it's already installed; the problem persists though.
I also came across this problem (while creating a simple installer for pyenv). Here's how I solved it for Mac and Linux:
Ubuntu 20.04, 18.04
You need the zlib development files, and probably zlib itself too:
sudo apt install -y zlib1g-dev zlibc
If you're missing zlib, it's likely that the next problem you'll run into is with openssl, so it's probably best to get that now as well:
sudo apt install -y libssl-dev
sudo apt install -y libssl1.1 || sudo apt install -y libssl1.0
macOS
I believe this comes with XCode CLI Tools (or at least I didn't have to custom install it Big Sur):
xcode-select --install
For me it worked in RHEL:
$ yum install zlib-devel
Suggested solutions (installing zlib1g-dev or zlib-devel) seem to resolve the issue in most cases. Here is one edge case I've encountered recently: whatever you are trying to run might use zlib via symlink which might be broken.
In my case I was trying to run a build of a 3rd-party software which already had python and all necessary libs being emebedded into it. It was packaged as a tar.gz archive. Unpacking the archive on a Windows machine and then copying the contents to another linux machine destroyed all the symlinks (if you do ls -l in a folder with symlinks you would see that all of them have size 0 and do not point to anything). Copying tar.gz to the linux machine directly and unpacking it there resolved the issue.
P.S. I know it's an edge case scenario but it took me and one more developer quite a while to figure it out so I think it's worth mentioning here, just in case someone gets as unlucky as I got.
Its solves my issue for centos 7.6 :-
yum install zlib-deve
Here's my problem,
I have a shared hosting (GoDaddy Linux Hosting package) account and I'd like to create .py file to do some scraping for me. To do this I need the scrapy module (scrapy.org). Because of the shared account I can't install new modules so I installed VirtualEnv and created a new virtual env. that has pip, wheel, etc. preinstalled.
Running pip install scrapydoes NOT complete successfully because scrapy has lot of dependencies like libxml2 and it also needs python-dev tools. If I had access to 'sudo apt-get ...' this would be easy but I dont'. I can only use pip and easy_install.
So How do I install the python dev tool? And how do I install the dependencies? Is this even possible?
Cheers
You can install all the dependencies by activating the python virtual environment first.
Step 1 :
On Linux :
env/bin/activate
On Windows :
env\Scripts\activate
Step 2:
pip install lxml
I just tried and it worked for me. Please find screen shot attached.
It's not possible to do what I wanted to do on the GoDaddy plan I had.
I had some of the same issues. I found this and modified to pip3.7 install lxml==3.4.2. I was able to install successfully.
Installed Django from source (python setup.py install and such), installed MySQLdb from source (python setup.py build, python setup.py install). Using Python 2.4 which came installed on the OS (CentOS 5.5). Getting the following error message after launching the server:
Error loading MySQLdb module: No module named MySQLdb
The pythonpath the debug info provides includes
'/usr/lib/python2.4/site-packages'
and yet, if I ls that directory, I can plainly see
MySQL_python-1.2.3-py2.4-linux-i686.egg
Using the python interactive shell, I can type import MySQLdb and it produces no errors. This leads me to believe it's a Django pathing issue, but I haven't the slightest clue where to start looking as I'm new to both Django and python.
EDIT: And to be a bit more specific, everything is currently running as root. I haven't setup any users yet on the machine, so none exist other than root.
EDITx2: And to be even more specific, web server is Cherokee, and deploying using uWSGI. All installed from source.
Have you considered installing MySQLdb from python packages?
I would also recommend doing this with pip instead of easy_install.
First you can replace easy_install with pip:
easy_install pip
pip install pip --upgrade
And then install Django via PIP:
pip install MySQL-python
pip install Django
Typically easy_install is installed already (part of setuptools), while pip is much better. It offers uninstallation options too, and uses flat install directories instead of the EGG files magic. This might resolve some incompatibilities as well.
Did you try building the dependencies? This solved it for me on Ubuntu:
sudo apt-get build-dep python-mysqldb
pip install MySQLdb-python
What worked for me (Linux Mint):
sudo apt-get install libmysqlclient-dev (this was the key for me)
pip install mysql-python
pip install django
You can find out where Python is looking for it's libraries by invoking "python manage.py shell" from the directory base of your Django project. Then do:
import sys
import pprint
pprint.pprint(sys.path)
And you'll see where the python is pulling libraries from. Also try to do a "import mysql" to see if that's kicking out an error.
Finally, the pathing for the WSGI service is (likely) configured with the uWSGI setup in Cherokee - sorry, I don't know the details of that critter to make suggestions on how to determine where/how it's loading the library path.
I was having this same problem, but it was only an issue inside a virtualenv.
What I did to finally fix it was
workon [project_name]
pip uninstall django
pip install mysql-python
pip install django
So making sure you install mysql-python before django seems to work.
This is on a Ubuntu system and using virtualenv.
Try this if you are using
linux:- sudo apt-get install python-mysqldb
windows:- pip install python-mysqldb or
easy_install python-mysqldb
Hope this should work
This did the trick for me:
sudo apt-get install python-dev
pip install mysql-python
Solved my problem :)
in my case, Python was able to access mySQL, but Django (1.6) gave the error: "Error loading MySQLdb module: No module named MySQLdb"
I am on a Macbook OSX (Maverick), by the way.
When I tried to run
pip install mysql-python
I got an error during compilation : "clang: error: unknown argument: ‘-mno-fused-madd’ [-Wunused-command-line-argument-hard-error-in-future]."
The problem, it turns out, is an updated behavior of cc compiler with the new Xcode 5.1. When there is a parameter it doesn't recognize, considers it as a fatal error and quits. The solution to override this behavior can be found here:
http://bruteforce.gr/bypassing-clang-error-unknown-argument.html
This issue was the result of an incomplete/incorrect installation of the MySQL for Python adapter.
Specifically, I had to edit the path to the mysql_config file to point to /usr/local/mysql/bin/mysql_config.
Discussed in greater detail in this article:
http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-leopard/