I'm new to Python.
I'm using winpython3 and winspyder3. How can I check which packages, modules and plugins are installed?
I didn't find anything here.
Thanks for the answers... but....
#Vineeth Sai: I'm using winspyder3, I get these error:
Start of code
pip freeze
The following command must be run outside of the IPython shell:
$ pip freeze
The Python package manager (pip) can only be used from outside of IPython.
Please reissue the `pip` command in a separate terminal or command prompt.
See the Python documentation for more information on how to install packages:
https://docs.python.org/3/installing/
End of Code
# Rajeev Atmakuri:
With the Code of your link, I get following output:
Start of code:
runfile('D:/Python/packages_001.py', wdir='D:/Python')
Traceback (most recent call last):
File "<ipython-input-6-a7b650970979>", line 1, in <module>
runfile('D:/Python/packages_001.py', wdir='D:/Python')
File "C:\WPy-3662\python-3.6.6.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
execfile(filename, namespace)
File "C:\WPy-3662\python-3.6.6.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/Python/packages_001.py", line 9, in <module>
installed_packages = pip.get_installed_distributions()
AttributeError: module 'pip' has no attribute 'get_installed_distributions'
End of code
at all:
if you know octave: with
start of code:
pkg list
end of code
you get a complete list of the installed packages...
Related
I would like to create a .exe file of a file named ZCasinoinsulte.py located in C:\Python\Scripts. Moreoever, every time I execute cxfreeze ZCasinoinsulte.py it never works and tells me it does not find _main_.py in cxfreeze.exe.
Specs: I have python 3.9.1 on Windows 10 64bit.
I have installed cx_Freeze-6.5.1 with whl.
It does create an exe file, but it opens and shuts down instantly (even though I put os.system("pause") in ZCasinoinsulte.py).
old code
Any help would be appreciated :D
Edit: I have used the cxfreeze version 6.4.2 and the code runs better without errors. But the exe file closes as soon as I clic on it.
Here is my pip list traceback:
C:\Users\Hmili>pip list
Package Version
------------------ -------
cx-Freeze 6.4.2
importlib-metadata 3.4.0
pip 20.3.3
setuptools 49.2.1
zipp 3.4.0
Here is the traceback when I execute the exe file from cmd:
C:\Python\Mes fichiers python\dist>ZCasinoinsulte.exe
Traceback (most recent call last):
File "c:\python\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 41, in run
module.run()
File "c:\python\lib\site-packages\cx_Freeze\initscripts\Console.py", line 36, in run
exec(code, m.__dict__)
File "ZCasinoinsulte.py", line 3, in <module>
File "c:\python\lib\site-packages\cx_Freeze\__init__.py", line 1, in <module>
import setuptools
File "c:\python\lib\site-packages\setuptools\__init__.py", line 24, in <module>
from setuptools.depends import Require
File "c:\python\lib\site-packages\setuptools\depends.py", line 6, in <module>
from .py33compat import Bytecode
File "c:\python\lib\site-packages\setuptools\py33compat.py", line 11, in <module>
from setuptools.extern.six.moves import html_parser
File "c:\python\lib\site-packages\setuptools\_vendor\six.py", line 92, in __get__
result = self._resolve()
File "c:\python\lib\site-packages\setuptools\_vendor\six.py", line 115, in _resolve
return _import_module(self.mod)
File "c:\python\lib\site-packages\setuptools\_vendor\six.py", line 82, in _import_module
__import__(name)
ModuleNotFoundError: No module named 'html.parser'
Here are the first ten lines of ZCasinoinsulte.py:
# -*-coding:Latin-1 -*
import os,time
from cx_Freeze import setup, Executable
from random import randrange
argent=3000
while argent>0:
condition1=0
condition2=0
argent=int(argent)
How do I resolve this? (Thanks for the help by the way :) )
I reverted cx_Freeze back to version 6.4.2, seemed to compile fine after that
pip install --upgrade cx-Freeze==6.4.2
Seems to be a bug or something.
First I downgraded pip as James Mackey advised me. The code ran properly and created an exe file. So the first issue was a comptability one.
Moreover, the exe file created crashed instantly when executed. From the traceback of the execution of ZCasinoinsulte.exe with cmd, James Mackey figured the third line of ZCasinoinsulte.py had an error related to it.
The third line of ZCasinoinsulte.py was:
from cx_Freeze import setup, Executable
I erased this line as it has nothing to do with the actual code.
I opened cmd and executed again the command: cxfreeze ZCasinoinsulte.py. The exe file now functions properly.
I have installed twint with:
pip3 install twint
which resulted in a successful installation:
Successfully installed twint-2.1.8
It works to get tweets from twitter using Command Prompt(CLI) commands but when I try to run the example in Spyder IDE it gives me the error:
"Traceback (most recent call last):
File "<ipython-input-13-7b77905cef0c>", line 1, in <module>
runfile('C:/Users/myname/twint.py', wdir='C:/Users/myname')
File "C:\Users\myname\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Users\myname\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/myname/twint.py", line 8, in <module>
import twint
File "C:\Users\myname\twint.py", line 9, in <module>
c = twint.Config()
AttributeError: module 'twint' has no attribute 'Config'
Here is my code:
import twint
c = twint.Config()
c.Username = "twitterAccountName"
twint.run.Search(c)
However, I looked twint related issues on GitHub found here but the solution provided here not worked for me. Does anyone know where the error coming from? How do I fix it?
The issue you linked to is the exact same problem you have. You need to rename your file to not be twint.py
Rename this file runfile('C:/Users/myname/twint.py
If you get other errors, then that's a separate issue
I am wanting to use pyautogui to automate some tasks but i am having trouble getting the package to work on Windows 7.
I am currently using anaconda and spyder (i have also tried python IDLE). I can install the pyautogui package without any errors, but when i try to run a simple command:
import pyautogui
pyautogui.displayMousePosition()
The above i got from a youtube video of Al Sweigart doing a demo of pyautogui, and from the outcome i would expect to see the x, y coordinates of the mouse pointer and the R,G,B numbers.
But when I run it I get the following messages:
runfile('C:/Users/david/.spyder-py3/temp.py', wdir='C:/Users/david/.spyder-py3')
Reloaded modules: pymsgbox, pyautogui, pyautogui._pyautogui_win, pymsgbox._native_win, pymsgbox.native, pyscreeze, pytweening
Press Ctrl-C to quit.
Traceback (most recent call last):
File "<ipython-input-5-0007268e4f6f>", line 1, in <module>
runfile('C:/Users/david/.spyder-py3/temp.py', wdir='C:/Users/david/.spyder-py3')
File "C:\Users\david\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
execfile(filename, namespace)
File "C:\Users\david\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/david/.spyder-py3/temp.py", line 2, in <module>
pyautogui.displayMousePosition()
File "C:\Users\david\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\pyautogui\__init__.py", line 1027, in displayMousePosition
pixelColor = pyscreeze.screenshot().getpixel((x, y))
File "C:\Users\david\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\pyscreeze\__init__.py", line 309, in _screenshot_win32
im = ImageGrab.grab()
NameError: name 'ImageGrab' is not defined
I have tried manually installing the dependenciies (pillow) in case that was the issue, but I cannot figure out how to fix the problem. I know the above message give a lot of info but I don't understand well enough to fix the issue.
Can anyone help? or tell me where i'm going wrong?
I'm trying to install xlutils package to access xls sheets in Python but unfortunately I'm unable to install it.
Python version 3.5.1
using spyder editor, have got this error.
runfile('E:/python_practice/task2/gen1.py', wdir='E:/python_practice/task2')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "C:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 88, in execfile
exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
File "E:/python_practice/task2/gen1.py", line 10, in <module>
from xlutils.copy import copy
ImportError: No module named 'xlutils'
so, downloaded xlutils from https://pypi.python.org/pypi/xlutils and unzipped, copied and pasted in sitepackages folder of python35 folder and as well as anaconda3 folder.But still i'm getting above mentioned error.
Have you read the docs of this module? It clearly explains everythinf you should do. There is a way to install it using pip. Type this in your command-line: pip install xlutils. That should install it. For any further problems, read the documentation.
EDIT: Never mind, this package is unavailable for Python 3.5
This package is support on Python 2.5, 2.6 and 2.7 on Linux, Mac OS X and Windows.
I'm attempting to follow this tutorial to install the natural language processing package spaCy into a python 3 anaconda environment, windows 8
I opened console, cd-ed to my site-packages folder, activated environment, pip-ed for install, everything seemed fine except I couldn't run the second command here
$ pip install spacy
$ python -m spacy.en.download
Now I can successfully load the package but when I run the second line below, I get the following error
>>> from spacy.en import English #this works
>>> nlp = English() #this doesn't
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\garrett\Anaconda\envs\py3k\lib\site-packages\spacy\en\__init__.py", line 64, in __init__
get_lex_props=get_lex_props)
File "spacy/vocab.pyx", line 42, in spacy.vocab.Vocab.__init__ (spacy/vocab.cpp:2216)
OSError: Directory C:\Users\garrett\Anaconda\envs\py3k\lib\site-packages\spacy\en\data\vocab not found -- cannot load Vocab.
I think that it is due to the fact that I couldn't run python -m spacy.en.download
Can anyone give me an idea of what python -m spacy.en.download is supposed to be doing?
Can anyone provide a walkthrough for how to get spaCy installed in an anaconda environment?
here's the error I get after setting the directory, activating python env, running command. The first several times I tried, my spyder editor went unresponsive and I killed the console, the most recent time I got this error
$ cd C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages
$ C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages>activate py3k
$ [py3k] C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages>python -m spacy.en.download
Moving existing dir C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages\spacy\en\data to /tmp
Traceback (most recent call last):
File "C:\Users\garrett\Anaconda\envs\py3k\lib\runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\garrett\Anaconda\envs\py3k\lib\runpy.py", line 73, in _run_code
exec(code, run_globals)
File ".\spacy\en\download.py", line 56, in <module>
plac.call(main)
File ".\plac_core.py", line 309, in call
cmd, result = parser_from(obj).consume(arglist)
File ".\plac_core.py", line 195, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File ".\spacy\en\download.py", line 51, in main
shutil.move(DEST_DIR, '/tmp')
File "C:\Users\garrett\Anaconda\envs\py3k\lib\shutil.py", line 521, in move
raise Error("Destination path '%s' already exists" % real_dst)
shutil.Error: Destination path '/tmp\data' already exists
appreciate any help or advice you can provide
You have hit this bug which should be already fixed in the last version. Apparently spacy can't download the data because the destination already exists (may be from a previous interrupted download). A workaround would be to delete the /temp/data folder and retry the download.