I am trying to learn python for GUI, I have worked on python for some time now.
I have installed pyforms module but when I try to import that module in my script it gives error saying no such module is available? Has any one faced this problem?
I have attached image to clarify what exactly is the problem.
Thanks in advance for any help on this.
Following is my output on my terminal.
C:\Dhaval\Learning\office>pip show pyforms
Name: PyForms
Version: 4.0.3
Summary: Pyforms is a Python framework to develop GUI applications based on pyqt
Home-page: https://github.com/UmSenhorQualquer/pyforms
Author: Ricardo Ribeiro
Author-email: ricardojvr#gmail.com
License: MIT
Location: c:\users\dhava\appdata\local\programs\python\python38-32\lib\site-packages
Requires: pyforms-terminal, pyforms-web, pyforms-gui
Required-by:
C:\Dhaval\Learning\office>python GUIExample.py
Traceback (most recent call last):
File "GUIExample.py", line 1, in <module>
import pyforms
ImportError: No module named pyforms
C:\Dhaval\Learning\office>pip install pyforms
Requirement already satisfied: pyforms in c:\users\dhava\appdata\local\programs\python\python38-32\lib\site-packages (4.0.3)
Below is my Code in file GUIExample.py
import pyforms
from pyforms.basewidget import BaseWidget
from pyforms.controls import ControlFile
from pyforms.controls import ControlText
from pyforms.controls import ControlSlider
from pyforms.controls import ControlPlayer
from pyforms.controls import ControlButton
print ("Hello World")
P.S - If I execute same script with pycharm then it works fine.
Please refer the image which shows clearly what the problem is.
Run the following command first. Maybe you have not installed the modules since they are not installed in default.
pip install pyforms
Related
>>> import docx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\users\kevin\mu_code\docx\__init__.py", line 3, in <module>
from docx.api import Document # noqa
File "c:\users\kevin\mu_code\docx\api.py", line 14, in <module>
from docx.package import Package
File "c:\users\kevin\mu_code\docx\package.py", line 9, in <module>
from docx.opc.package import OpcPackage
File "c:\users\kevin\mu_code\docx\opc\package.py", line 9, in <module>
from docx.opc.part import PartFactory
File "c:\users\kevin\mu_code\docx\opc\part.py", line 12, in <module>
from .oxml import serialize_part_xml
File "c:\users\kevin\mu_code\docx\opc\oxml.py", line 12, in <module>
from lxml import etree
ImportError: cannot import name 'etree'
I have python-docx 0.8.10 and lxml 4.5.0, windows 10. I tried googling already but I'm not sure if I followed the suggestions correctly or if it's applicable in my case (lxml problems). I haven't had any problems installing other modules using "pip install" so I'm stuck and don't know how to proceed from here.
Check this,
Use pip install, to install the docx library and if you have already install it successfully then have a look into its dependencies. I think it is because of the incompatibility with its dependencies that is why you are getting the error.
pip install python-docx
Dependencies
Python 2.6, 2.7, 3.3, or 3.4
lxml >= 2.3.2
I don't know whether this may be an appropriate solution for you. But this is what I generally follow. Just install Anaconda in your system and an environment according to your needs. For your case create an environment for Python 3.4 using the following command
conda create --name py34 python=3.4
You then install libraries according to your needs in the respective environment. Now you can work into each environment without interfering with the libraries of the other environment. To use anaconda kindly follow Anaconda cheatsheet.
Kindly refer to the link. Hope this helps you.
This is almost certainly a problem with the lxml install. python-docx works with all versions of Python >= 2.6.
Instead of import docx, try from lxml import etree. If this produces the same error message, you know you've narrowed it down.
lxml depends on a couple of C libraries, lib2xml and libxslt if I remember correctly. These are sometimes tricky to install. In any case, you'll find solutions to those problems by searching on "lxml install windows" or similar.
Once from lxml import etree works without error I think you'll find import docx does too.
Window10 and Python3.7.4
The lib I am trying to use is 'colorama'.
When i run the python script file (x.py) it cannot find the module in the line which is "import colorama", but when i open a cmd and enter python env then type 'import colorama', it works. Does any one know what's the reason?
'''
>>>D:\Scratch\commands>mypythonscript.py
>>>Traceback (most recent call last):
>>> File "D:\Scratch\commands\mypythonscript.py", line 12, in <module>
>>> from colorama import init, Fore, Back, Style
>>>ModuleNotFoundError: No module named 'colorama'
'''
I don't know why this issue arise but maybe I installed VS2019. Before this, it worked fine for me.
Try to find which python your are working with using SYS module with its VERSION method in this way:
import sys
print(sys.version)
And then verify if you are using the same python version as you are using on cmd.
Another problem could be the path of your module, try to locate it with the "magical method" of your module installed, for example in this case:
import colorama
print(colorama.__file__)
And then verify if colorama is in this path: ".../Python37/lib/site-packages/colorama"
if not, download COLORAMA from here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/
unzip it with 7ZIP
and all unzip files copy to : ".../Python37/lib/site-packages"
don't worry for the module version, colorama is for all python versions.
NOTE: this only works for windows version.
I get this error when trying to setup Unity3d ml-agents
ImportError: cannot import name 'cluster_resolver'
Following https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Installation.md tutorial
from tensorflow.contrib import cluster_resolver
Error happens when I try to run mlagents-learn --help
I am on MacOS with Python 3.6
Fixed by using Tensorflow 1.7.0 instead of 1.7.1 as in the tutorial.
I want to use pyforms to prepare a simple python based program and have been trying to install and use it with no luck.
When I run:
import pyforms
from pyforms import BaseWidget
from pyforms.Controls import ControlText
from pyforms.Controls import ControlButton
All I get is a Traceback error in the terminal and:
from pysettings import conf;
ImportError: cannot import name 'conf'
I'm using pysettings 1.90 and pyforms 0.1.7.3
I've uninstalled and reinstalled several times with no luck and have been using python3.4.
Can anyone help?
You will need to download and install pysettings from https://github.com/UmSenhorQualquer/pysettings/tree/92bde8c680bc0a00ae97cc09bd4dab1b697d6ed2
The original pysettings will not work.
I am having an issue importing the client module after installing the pywin32 extension for windows. I can import win32com with no issues at all, but I recieve an error when I try importing the client module. I realize this question has been asked numerous times, but here is what I have tried:
I have installed and reinstalled the correct version of pywin32. I have Python version 3.5 (32 bit) and I have installed the 3.5 32 bit file.
I have updated my PATH variable and my PYTHONPATH variable to include the locations of both the win32com and the client module.
I've manually ran the postinstall win32com script (not sure what this would do but I've read that it has helped some people)
It is worth noting that I can import sys, os, win32com, and win32com.client in the python IDLE, but when I run the import from a script in the same format, Python tells me it can't find the win32com.client module.
I receive the following error when running the win32com.client import from a script:
Traceback (most recent call last):
File "C:\Users\10023539\Desktop\pyscripts\outlook.py", line 3, in <module>
import win32com.client
ImportError: No module named 'win32com.client'; 'win32com' is not a package
I'm not sure what else to try at this point, any help would be greatly appreciated.