Need help setting up a Windows 10 Python environment - python

Nube at Python but application I want to use is written in it and I am having trouble getting this application to work.
I have been searching for answers but perhaps don't know enough to ask the right questions.
I am running windows 10 (new to it also). I have installed Python 3.10.1 from the Windows store. It is in the path statement and does execute from cmd prompt.
As my application uses YAML I have also installed PyYaml,
I have no idea if it installed correctly, where it is installed and it is not in the PATH.
My application called wireviz.py is launched from its source folder by typing wireviz -V. It fails at line 10 with ModuleNotFoundError: No module named 'yaml'.
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 import argparse
5 import os
6 from pathlib import Path
7 import sys
8 from typing import Any, Tuple
9
10 import yaml
I know much more may be needed, but frankly I don't know
what and maybe even how to get it.

The error message indicates that PyYAML is not installed; since PyYAML is registered under the Python Package Index (PyPI) as yaml, you should install it using pip (the Python package installer). The command might look like this:
pip install yaml
There are many more nuances to learn about package installation, but for the time being this should get you up and running.

Problem solved thanks to Austin advise.
Because of it I did some research on Python Installer to get a better feel for the process.
Found my stuff was installed all over the place.
Found a pip package for my application so I deleted everything including Python and did a fresh install of Python and the "Graphviz" applications.
Then installed my application (WireViz.py) using pip install.
Application and all required modules installed without error and after checking PYTHONPATH, everything is now working.
Thanks for the help.

Related

So i installed numpy . But when i call it in a program an error occurs. Any method to solve it permanently in windows 10

Here is the error
import numpy
Exception has occurred: ModuleNotFoundError
No module named 'numpy'
File "C:\path\to\file\32.py", line 1, in <module>
import numpy
Let me know how did you install the NumPy package; using pip or something else?
If you have multiple python versions, i.e. 2.x and 3.x at the same time, please make sure your interpreter for the 32.py file is the version that you installed NumPy on.
To possibly fix your problem, you should first try installing it and see if there are any errors. You should also check the version of Python you are running on Windows 10, because when you update Python it sometimes switches names between py and python
As you can see, the version of Python has changed between py and python so you should try changing that first.
If this does not work, you should try finding the directory for NumPy and adding it to the system PATH in your script. The installer usually shows you the location by doing the following:
import sys
sys.path.append("<insert numpy location here>")
import NumPy
This should manually force it into finding the package. If none of this works, please tell us and we should be able to find a different solution.
Happy Coding!
If you're using a code editor like PyCharm, you could install it by clicking on
file then settings then the project interpreter setting and install new module! You can search for the module and install.
Make sure that the python version that you want to use is a Windows Environmental Variable. You can test this by running this line in your command line.
> python --version
If you get some other python version that is not the one that you wish to use you can set the python version you want by finding where exactly your Python folder is located and go into settings and set the path as a new variable (I can leave a tutorial for you). If that is too much of a hassle, the Python installers can set the python that you will install as an environmental variable for you. (You could uninstall and reinstall and make sure that you allow it to make it an environmental variable.
After that you should be able to import whatever external packages you want using pip
for example:
pip install numpy

How to import third party python module Mac OS X - anki

I am relatively new to programming and posting to Stack Overflow. Please forgive my ignorance.
I am attempting to use a third party module in a program of my own, however I can't work out how to access the module within my Python script.
Mac OS X Sierra 10.12.4
Python 3.6.1
Anaconda 4.3.1
Specifically, I would like to be able to access anki (https://github.com/dae/anki).
I initially tried the line:
from anki import Collection
That resulted in a 'ModuleNotFoundError'.
Next I tried:
conda install anki
which also didn't work and yielded a 'PackageNotFoundError'
After more searching, I decided to try:
import sys
sys.path.append('usr/share/anki')
from anki import Collection
However, this also results in a 'ModuleNotFoundError'
What do I need to do to be able to access this module?
I am sure that it is possible because I have come across several other programs which make use of it:
-https://eshapard.github.io/anki/open-the-anki-database-from-python.html
I recognize that the link above purports to offer a solution to exactly this problem, however the solution proffered isn't working for me. Thanks in advance.
You are telling about Anki for desktop computers, which IS application written in Python, but it is NOT an installable Python package.
So the commands like
conda install anki
or
pip install anki
have no meaning.
So the only way is to download full source code of this project, unzip the content of it (only) folder into your project (change you actual folder to it) and then you may do import commands.

How to install python modules on mac

I'm a complete beginner in Python programming. I have trouble installing/importing the module 'requests' on python. When I use my command terminal to install requests, I get a message that requests is already installed. However, when I try to import requests into the file I'm working on, python tells me there is no such module installed.
Sorry to bother you with this silly and probably easy question, thanks in advance!
If you use PyCharm (which is a great choice in my opinion), go to the tab Run and select Edit Configuration and in the window that just opened make sure the your Python interpreter is the one you used when you pip installed the package you asked about.
You can check your Python version or just see in PyCharm if the requests is actually installed by going to the tab File, select Settings, click on Project: name_of_your_project and finally check in Project Interpreter that the package is installed.

Can not import pygst under windows 7 (32bit)

I am using windows 7 (32bit) and python 2.7.3.
For gstreamer, I installed:
GStreamer-WinBuilds-LGPL-x86-Beta04-0.10.7
GStreamer-WinBuilds-SDK-LGPL-x86-Beta04-0.10.7
However, I get the following error:
ImportError: No module named pygst
And I was confused with previous similar questions and answers, anyway I can't fix this by copy files or rename dlls.
python-gst0.10 is only in extras-devel right now. You have to add this repository to your /etc/apt/sources.list:
http://repository.maemo.org/extras-devel
This should work. If it doesn't add a comment :)
OK. I tested these on win xp with python 2.7. It's absolutely OK!
Then I check again in win 7, after my installing of GStreamer. Python could not import pygsst, however as there is already PYTHONPATH for gstreamer. I just checked this enviroment variables in system variables, and I found python can import pygst ... Maybe it is the problem of WIN7, system permissions or delay? Have no idea...

Can't get import to be recognized - jsonpickle

I am using PyDev via eclipse and have used easy_install to get jsonpickle. No matter what I do I can't seem to get the import to work.
What I have tried thus far:
I have removed it from easy_install.pth and deleted the egg and installed again.
Add my python lib, dll, etc folders to a PYTHONPATH system variable
Restarted eclipse
Other imports are working fine. Not sure what I am doing wrong?
EDIT:
Sorry should have included OS / Python version.
OS: Windows 7
Python: 2.7
Any suggestions greatly appreciated
OS and python version?
Please use pip. Always.
pydev seems to ignore your package. It should be in /usr/share/pythonX.Y/site-packages/jsonpickle, or, if on Windows, c:\pythonxx[...].
If using Linux, please try to find a distro package for jsonpickle.

Categories

Resources