new to python and trying to use plotly and I somehow broke something...
did pip install plotly, that worked.
was able to do "import plotly" in CLI, ok all good
then wrote a script and named it plotly.py
ran that and it can't find the module plotly
thinking the naming is causing a problem, I renamed my script to ptest.py, still can't find the module
read up here a bit... printing sys.path shows the directory plotly is in
checked the dir and made sure it is readable by all (it wasn't)
Still can't find the module
Added this to the script:
import sys
sys.path.append("path to module")
still can't find the module...
uninstall and reinstalled the module, no go.
Related
I think this is one of the many questions about missing modules and py2exe... anyway...
PylibUty is a local package located in C:\Dati\workspaces\PythonEclipse\APyLibUty\PyLibUty and referred in every .py file with:
import sys, os
sys.path.append(os.path.join(os.path.dirname("file"), '..'))
sys.path.append("C:/Dati/workspaces/PythonEclipse/APyLibUty")
from PyLibUty.pystr import randomString, insertStr
uuid is a Python package so I normally import it
_posixshmem I am not able to find what package I should install using pip/pipenv
resource: I installed both resource and pyresource using pip/pipenv bat nothing changed
What should I install or import to solve these problems?
This is the output produced running py2exe:
I did not find a solution to understand what modules I should add or install to clear the problems of py2exe, so I searched the web to find a different tool able to make exe files from Python sources. I found cx_freeze, actually it does not produce the errors I reported so at the moment I switched to cx_freeze. I will test it better but at the moment my problem is solved.
I can't figure out how to troubleshoot an import that says it's working, but then obviously is failing. I'd appreciate any clues where to look.
I'm working on a raspberry Pi, but I'm seeing the same results on my windows machine. Both running Python 3.7 with Pip 20.
I start by installing the module with pip sudo pip3 install adafruit_pca9685
As you can see it says it's installed correctly.
Then I check that the module is installed with help('modules')
As you can see, it reports that the module isn't there right after it said it installed correctly.
Then I try to import the module with import adafruit_pca9685
Then it says that the module isn't found.
What should I be checking next to help solve this?
TLDR: Used find command to search for the file and found it was spelled differently than the tutorial indicated.
Oh man, do I feel dumb...
After suggesting I look for the file, I used find / -type f -iname "PCA9685.py.
I found the module installed, but it uses capitalization rather than all lower case which is what my documentation was requesting.
After correctly spelling the module name with capitalization, it imports fine.
It's annoying that this module is named in a different format than its sister modules, and annoying that the tutorial was wrong, but I feel dumb for not double checking the spelling.
I'm trying to set up a roguelike Python project, but I can't seem to be able to import libtcod module into my project. This helloworld crashes, and the IDE keeps telling me that there is no module named libtcodpy.
import libtcodpy
def main():
print('Hello World!')
if __name__ == '__main__':
main()
What is the proper way to import modules into Python projects? I'm used to Java, so I was expecting something along the lines of Maven to manage the dependencies. There indeed seems to be something like that in PyCharm as well, this package manager for the venv, which from what I gather serves to isolate the project-specific stuff from the OS- or python-global stuff:
but libtcod simply isn't present in the rather exhaustive list of modules that appears after clicking on the "+" button, just some other module that has something to do with libtcod library (I guess?). Moreover, all the tutorials I found on setting libtcod up advise one to manually copy over files somewhere or run some command that I suppose does the importing somehow and other such solutions, all of which i tried and none of which worked. I don't want to pollute my project structure by using such hodgepodge ways of handling dependencies if I can at all avoid it.
Q: How do I get libtcod to work in my PyCharm project in the most clean and convention-abiding way possible?
Take a look at this github project called tcod: https://github.com/libtcod/python-tcod/blob/master/README.rst#installation
It's a python port of libtcod.
To install using pip, use the following command:
python -m pip install tcod
If you get the error "ImportError: DLL load failed: The specified module could not be found." when trying to import tcod/tdl then you may need the latest Microsoft Visual C runtime.
Blockquote
I have no idea why this is so frustrating, but I have literally pulled out a few clumps of hair in rage because this just refuses to work and I honestly do not have the slighest clue on what to do. I am trying to use the winshell module for a quick python programming I am using. I am new to python and just started trying it today. I have tried to install the library manually, and through pip. pip claims the module is downloaded, and I can see it in the lib folder. No matter what I do I get this error when I try to run my code:
import winshell
ModuleNotFoundError: No module named 'winshell'
what on earth must I do to get this to work I am at my wits end here and I feel like I'm going to break something
You have to install the library with:
pip install winshell
I just tested with pip3 install winshell and it worked.
Python interpreter search for modules in the set of directories that you can see with:
import sys
print(sys.path)
I recommend you take a look to see if the directory where you are seeing the library in lib is include in that list.
Might be useful to you read: The Module Search Path
I had installed OpenCV, and it was working just fine. But I noticed that a few libraries were missing.
So I decided to install another copy. I moved the working copy to another directory, and started the install of the new one. I was having trouble with this new install, so I cancelled it and moved my old OpenCV install back to its original directory.
But now, my old install doesn't work anymore. Each time I try to run something, it says "ImportError: No module named cv2" or "ImportError: No module named cv" (depending on what was being imported in the file).
What do I do to fix this? I remember encountering a similar issue the first time I installed and ran this copy of OpenCV, and something had to be changed with the Python Path to work correctly. I can't quite remember, and I'm kind of confused about why those settings would change, if they indeed have.
Please let me know what I can do to rectify this. I am using OS X 10.9. Thank you.
UPDATE: I added this to my .bash_profile: export PYTHONPATH=/Users/santosh/opencv-2.4.7/build/lib:$PYTHONPATH. But now when I run opencv samples, I get "Segmentation fault: 11". Any thoughts?