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 (- -).
Related
Hope everyone is doing fine :)
I'm new to python, so I'm having trouble cause I've installed anaconda (for machine learning) and now, my local projects in VS Code with python, don't find modules installed from pip install.
I've searched online and I guess it has something to do with the path... Here's the path when I install the module:
user_stuff.../opt/anaconda3/lib/python3.9/site-packages
I want to install modules into my project on desktop, here's the path:
user_stuff.../Desktop/python-project
I keep getting this error when trying to import:
ModuleNotFoundError: No module named 'qrcode'
How do I change this? It's really frustrating :(
I guess your pip is referring to the pip provided by the system, it should be now referring to the pip provided by anaconda.
$ which pip
$ alias pip="/Users/my-username/anaconda3/bin/pip"
$ pip install qrcode
Do you use jupyter notebook in vs code? I prefer it because there you can easily select the environment you are using. And if you want to pip install anything in a environment you have to first activate it in the console with conda activate env name
For my project requirements I had installed Python packages like Jira and Bitbucket to connect to the servers using their API wrappers. After I installed Anaconda all the existing packages stopped working. Now Im getting No Module Found error for both Bitbucket and JIRA although the modules are already installed
For example :
pip3 install bitbucket-python
gives me that requirement is already satisfied. But when I run the code I get:
No module named "bitbucket" found
The same code was running fine 2 days ago before I installed anaconda.
Please help.
Now you have different versions of python and pip in your system. You have to make sure you are running correct version of the command. In my system with conda installed and activated pip3 refers to pip for system python. and pip for active conda python.
Try this: pip install bitbucket-python
you can use which command to see which binary is getting executed for example on my system.
dhananjay#ideapad:~$ which python
/home/dhananjay/.conda/bin/python
dhananjay#ideapad:~$ which pip
/home/dhananjay/.conda/bin/pip
dhananjay#ideapad:~$ which pip3
/usr/bin/pip3
I've just installed Python for the first time and I'm trying to reference the win32com module however, whenever I try to import it I get the message "no module name win32com".
Any ideas?
the below plus add pywin32 in PyCharm setting work for me
python -m pip install pywin32
As it is not built into Python, you will need to install it.
pip install pywin
Since win32com is a Windows-specific package, this answer will be geared towards Windows users.
Option 1: Install locally with pipenv (recommended)
You can use a package manager like pipenv to manage your dependencies.
Ensure you have pipenv installed (pip install pipenv).
In your project directory, run pipenv install pypiwin32 to install the package.
Now you can run your code using commands like the following pipenv run main.py
Example main.py code:
import win32com
print(win32com)
Option 2: Install locally with venv (recommended)
If pipenv isn't your thing, you can use the built-in virtual environments.
From your project directory, run python -m venv venv to setup you virtual environment.
Run venv\Scripts\activate.bat from your project directory whenever you want to use this virtual environment (you will see (venv) added to your shell prompt to know it's activated).
Run pip install pypiwin32 from your active virtual environment to install the package.
You can run your code like python main.py so long as the virtual environment is active.
Option 3: Install globally (typically not recommended)
This is not typically recommended, but included anyway.
Using pip install pypiwin32 you can install the package globally.
Then you can run your code with just python main.py.
This will work as well
python -m pip install pywin32
You should try using pip this way:
pip install pypiwin32
It is pypiwin32 which should work.
When working with python projects its always a good idea to create a so called virtual environment, this way your modules will be more organized and reduces the import errors.
for example lets assume that you have a script.py which imports multiple modules including pypiwin32.
here are the steps to solve your problem:
1. depending on you operating system you need to download and install virtualenv package, in debian its as simple as sudo apt install virtualenv .
2. after installing 'virtualenv' package go to your project/script folder and create a virtualenv folder with virtualenv venv it creates a folder named venv in that directory.
3. activate your virtualenv source /path/to/venv/bin/activate if your already in the directory where venv exists just issue source venv/bin/activate
4. after activating your venv install you project dependencies pip install pypiwin32 or pip install pywin
5. run your script, it wont throw that error again :)
I have a MacBook Pro that came pre-installed with python2.7. I later installed python3 and ipython notebook. I installed pip too to install packages, and am able to install packages and run program from python3. However, for another project I need to run code in python2.7, and I am not sure how to install it in python2.7 folder.
I tried using pip for installing packages to 2.7, but it kept giving error saying package already exists. When I check for version of python using --version, I see 2 pythons installed. However, when I check for pip and pip3, both seem to be in th same folder.
Any tips on how to install packages in python2.7, without making any changes to 3.3? I am using python3 and ipython notebooks for another project.
viveks-mbp:~ vivekyadav$ which pip
/Library/Frameworks/Python.framework/Versions/3.3/bin/pip
viveks-mbp:~ vivekyadav$ which pip3
/Library/Frameworks/Python.framework/Versions/3.3/bin/pip3
viveks-mbp:~ vivekyadav$ which python
/usr/bin/python
viveks-mbp:~ vivekyadav$ which python3
/Library/Frameworks/Python.framework/Versions/3.3/bin/python3
You can use the virtualenv to create a kind of sandbox.
$ virtualenv <work-directory>
$ source <work-directory>/bin/activate
The last command initiate your virtual environment, totally isolated from the system. So every pip command will install the package inside this directory.
But you have to run your application inside the virtual environment too.
I'm using the most recent versions of all software (Django, Python, virtualenv, MySQLdb) and I can't get this to work. When I run "import MySQLdb" in the python prompt from outside of the virtualenv, it works, inside it says "ImportError: No module named MySQLdb".
I'm trying to learn Python and Linux web development. I know that it's easiest to use SQLLite, but I want to learn how to develop larger-scale applications comparable to what I can do in .NET. I've read every blog post on Google and every post here on StackOverflow and they all suggest that I run "sudo pip install mysql-python" but it just says "Requirement already satisfied: mysql-python in /usr/lib/pymodules/python2.7"
Any help would be appreciated! I'm stuck over here and don't want to throw in the towel and just go back to doing this on Microsoft technologies because I can't even get a basic dev environment up and running.
If you have created the virtualenv with the --no-site-packages switch (the default), then system-wide installed additions such as MySQLdb are not included in the virtual environment packages.
You need to install MySQLdb with the pip command installed with the virtualenv. Either activate the virtualenv with the bin/activate script, or use bin/pip from within the virtualenv to install the MySQLdb library locally as well.
Alternatively, create a new virtualenv with system site-packages included by using the --system-site-package switch.
source $ENV_PATH/bin/activate
pip uninstall MySQL-python
pip install MySQL-python
this worked for me.
I went through same problem, but using pip from virtualenv didn't solve the problem as I got this error
error: could not delete '/Library/Python/2.7/site-packages/_mysql.so': Permission denied
Earlier I had installed the package by sudo pip install mysql-python
To solve, copy files /Library/Python/2.7/site-packages/MySQL_python-1.2.5-py2.7.egg-info and /Library/Python/2.7/site-packages/_mysql* to ~/v/lib/python-2.7/site-packages and include /usr/local/mysql/lib in DYLD_LIBRARY_PATH env variable.
For the second step I am doing export DYLD_LIBRARY_PATH=/usr/local/mysql/lib in ~/.profile