Posts: 4
Threads: 1
Joined: Aug 2017
Aug-17-2017, 02:11 PM
(This post was last modified: Aug-17-2017, 02:40 PM by Katsuke.)
Hello everyone!
I'm completely new with Python and Python 2.7, but I'm using it cause I need to run a conde on it. On this code, there's this call for using the 'asizeof' from Pympler:
from pympler import asizeof I've downloaded it from github.com/pympler/pympler, but I was unable to install it by running the "setup.py" file on Pythion 2.7, but I got this:
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (
Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> execfile('C:\Python27\pympler-master\pympler-master\setup.py')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\pympler-master\pympler-master\setup.py", line 11, in <module
>
import pympler.metadata as metadata
ImportError: No module named pympler.metadata and now I'm stuck on this part
If anyone can guide me through this, I'd appreciate!
Kind Regards,
Katsuke
P.S.: I'm running it on Win 7.
Posts: 7,324
Threads: 123
Joined: Sep 2016
You can use pip install pympler
A demo i have 3.6 as main OS version,so i use py -version to use 2.7.
You should also use Python 3,pympler work fine for 3.6.
# Check pip
C:\>py -2.7 -m pip -V
pip 9.0.1 from C:\Python27\lib\site-packages (python 2.7)
# Install
C:\>py -2.7 -m pip install pympler
Collecting pympler
Downloading Pympler-0.5.tar.gz (170kB)
100% |################################| 174kB 793kB/s
Installing collected packages: pympler
Running setup.py install for pympler ... done
Successfully installed pympler-0.5
# Test
C:\>py -2.7
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pympler import asizeof
>>> obj = [1, 2, (3, 4), 'text']
>>> asizeof.asizeof(obj)
192
>>>
Posts: 4
Threads: 1
Joined: Aug 2017
So, you're running it on a Unix system?
Cause I have some limitations regarding OS and version: I can only access Windows 7 and 10, and just Python 2.7 :(
Posts: 7,324
Threads: 123
Joined: Sep 2016
(Aug-17-2017, 03:12 PM)Katsuke Wrote: So, you're running it on a Unix system? Cause I have some limitations regarding OS and version: I can only access Windows 7 and 10, and just Python 2.7 :( No Unix to not have C:\> ,i use Win-10 and install to Python 2.7 in demo over,work just the same in Win-7.
Posts: 4
Threads: 1
Joined: Aug 2017
Aug-17-2017, 03:42 PM
(This post was last modified: Aug-17-2017, 03:42 PM by Katsuke.)
(Aug-17-2017, 03:18 PM)snippsat Wrote: (Aug-17-2017, 03:12 PM)Katsuke Wrote: So, you're running it on a Unix system? Cause I have some limitations regarding OS and version: I can only access Windows 7 and 10, and just Python 2.7 :( No Unix to not have C:\> ,i use Win-10 and install to Python 2.7 in demo over,work just the same in Win-7.
Ok, let´s go slowly. I'm feeling quite dumb trying to figure out where you've runned this code (I tried on Python and on Powershell [cause I don't have access to cmd] with no success):
# Install
C:\>py -2.7 -m pip install pympler I'm not used to command lines in general for installing stuff, if you have some more patience, can you assist me on this?
__________
P.S.:
During get-pip.py execution, I got this error:
>>> execfile('C:\Users\user\Desktop\Iconography\get-pip.py')
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connecti
on broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connect
ion.VerifiedHTTPSConnection object at 0x03768B70>, 'Connection to pypi.python.or
g timed out. (connect timeout=15)')': /simple/pip/
Operation cancelled by user
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\Desktop\Iconography\get-pip.py", line 20061, in <module
>
main()
File "C:\Users\user\Desktop\Iconography\get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "C:\Users\user\Desktop\Iconography\get-pip.py", line 172, in bootstrap
sys.exit(pip.main(["install", "--upgrade"] + args))
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\__init__.py",
line 233, in main
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\basecommand.py
", line 252, in main
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\utils\outdated
.py", line 126, in pip_version_check
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\sessions.py", line 488, in get
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\download.py",
line 386, in request
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\sessions.py", line 475, in request
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\sessions.py", line 596, in send
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\cachec
ontrol\adapter.py", line 47, in send
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\adapters.py", line 423, in send
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\packages\urllib3\connectionpool.py", line 595, in urlopen
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\packages\urllib3\connectionpool.py", line 352, in _make_request
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\packages\urllib3\connectionpool.py", line 831, in _validate_conn
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\packages\urllib3\connection.py", line 254, in connect
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\packages\urllib3\connection.py", line 142, in _new_conn
File "c:\users\user\appdata\local\temp\tmp6zwz2n\pip.zip\pip\_vendor\reques
ts\packages\urllib3\util\connection.py", line 88, in create_connection
KeyboardInterrupt
>>>[b]
>>> C:\>Python27 -m pip install pympler
File "<stdin>", line 1
C:\>Python27 -m pip install pympler
^
SyntaxError: invalid syntax[/b]
>>> execfile('C:\Users\user\Desktop\Iconography\get-pip.py')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\user\Desktop\Iconography\get-pip.py", line 20061, in <module
>
main()
File "C:\Users\user\Desktop\Iconography\get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "C:\Users\user\Desktop\Iconography\get-pip.py", line 168, in bootstrap
cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))
File "C:\Python27\lib\pkgutil.py", line 591, in get_data
return loader.get_data(resource_name)
IOError: zipimport: can not open file c:\users\user\appdata\local\temp\tmp6zw
z2n\pip.zip
>>>
Posts: 7,324
Threads: 123
Joined: Sep 2016
Aug-17-2017, 04:23 PM
(This post was last modified: Aug-17-2017, 04:24 PM by snippsat.)
Now you using python interactive shell,
you most use cmd commando line,if can not access as you say use powershell .
First you cd in python27 Scripts folder and check if you have pip.
All version after Python 2.7.9 comes with pip pre-installed.
Here how to check pip and install in Powershell.
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
# cd into Scripts folder where pip.exe is placed.
PS C:\Windows\System32\WindowsPowerShell\v1.0> cd\
PS C:\> cd python27\Scripts
# Check version
PS C:\python27\Scripts> .\pip -V
pip 9.0.1 from c:\python27\lib\site-packages (python 2.7)
# Check if upgrade is okay
PS C:\python27\Scripts> .\pip install --upgrade pip
Requirement already up-to-date: pip in c:\python27\lib\site-packages
# pip is okay now can install Pympler
PS C:\python27\Scripts> .\pip install pympler
Collecting pympler
Downloading Pympler-0.5.tar.gz (170kB)
100% |################################| 174kB 1.2MB/s
Installing collected packages: pympler
Running setup.py install for pympler ... done
Successfully installed pympler-0.5
PS C:\python27\Scripts>
Posts: 3,458
Threads: 101
Joined: Sep 2016
(Aug-17-2017, 03:42 PM)Katsuke Wrote: During get-pip.py execution, I got this error:
pip comes bundled with python. You don't need to get it, because you should already have it. C:\Users\me>pip -V
pip 9.0.1 from c:\users\me\appdata\local\programs\python\python35-32\lib\site-packages (python 3.5) Quote:>>> execfile('C:\Users\user\Desktop\Iconography\get-pip.py')
Why are you using execfile? Don't do that, don't use exec, and don't use eval.
Posts: 4
Threads: 1
Joined: Aug 2017
Aug-17-2017, 05:35 PM
(This post was last modified: Aug-17-2017, 05:36 PM by Katsuke.)
Thanks everyone, so far ,for the help!
Indeed, I could check that pip was already installed with my 2.7.13 version. So, I tried to run the Pympler installation:
PS C:\Python27\scripts> .\pip install pympler
Collecting pympler
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02B4D810>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/pympler/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02B4DAD0>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/pympler/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02B4DA10>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/pympler/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02B4DAB0>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/pympler/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip
._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x02B4D730>, 'Connection to pypi.python.
org timed out. (connect timeout=15)')': /simple/pympler/
Could not find a version that satisfies the requirement pympler (from versions: )
No matching distribution found for pympler It seems, to me, that it might be a proxy/firewall issue, which I'd need to request access at work to install it. Am I right?
(Aug-17-2017, 04:47 PM)nilamo Wrote: Why are you using execfile? Don't do that, don't use exec, and don't use eval.
Hello Nilamo!
I was using exefile cause it's the only command I know at the moment to run my *.py files... And I have just one use of eval over here, but not sure how to replace it:
def execute(self, function):
# must receive function with parameters
eval('self.conn.root' + function) Thanks :)
Posts: 7,324
Threads: 123
Joined: Sep 2016
Aug-17-2017, 05:37 PM
(This post was last modified: Aug-17-2017, 05:37 PM by snippsat.)
(Aug-17-2017, 05:30 PM)Katsuke Wrote: It seems, to me, that it might be a proxy/firewall issue, which I'd need to request access at work to install it. Am I right? You need a working connection out,because is finding the version online then download.
If you can try run powershell as Administrator,and try again
You right click as choose run as Administrator.
|