Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import psutil #313

Closed
giampaolo opened this issue May 23, 2014 · 12 comments
Closed

Can't import psutil #313

giampaolo opened this issue May 23, 2014 · 12 comments

Comments

@giampaolo
Copy link
Owner

From [email protected] on August 01, 2012 15:07:26

What steps will reproduce the problem?  
1. Install psutil 0.5.1 from source (on Linux)
2. python setup.py install
3. >>> import psutil 

What is the expected output?  
psutil should be imported 

What do you see instead?  
michal@cdn-controller:~/psutil-0.5.1$ python
Python 2.6.6 ( r266 :84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "psutil/__init__.py", line 94, in <module>
    TOTAL_PHYMEM = _psplatform.phymem_usage()[0]
  File "psutil/_pslinux.py", line 140, in phymem_usage
    cached = cached_phymem()
  File "psutil/_pslinux.py", line 121, in cached_phymem
    raise RuntimeError("line not found")
RuntimeError: line not found
>>> 

What version of psutil are you using? What Python version?  
psutil 0.5.1
python 2.6.6 

On what operating system? Is it 32bit or 64bit version?  
Debian 6.0 (Squeeze), 64b, kernel 2.6.32-5-openvz-amd64
I'm running virtualized Linux inside OpenVZ. 

Please provide any additional information below.  
_pslinux.py tries to read "Cached:" in /proc/meminfo, but there is no such line 
in my file:
cat /proc/meminfo
MemTotal:        4194304 kB
MemFree:         3757852 kB
SwapTotal:             0 kB
SwapFree:              0 kB

Original issue: http://code.google.com/p/psutil/issues/detail?id=313

@giampaolo
Copy link
Owner Author

From g.rodola on August 01, 2012 06:11:48

Could you please try latest SVN version?
I've been doing a lot of work against memory-related stuff lately so the issue 
at hand might already have been fixed by my changes.

@giampaolo
Copy link
Owner Author

From [email protected] on August 01, 2012 06:25:31

SVN version seems to work properly, thanks!

@giampaolo
Copy link
Owner Author

From [email protected] on August 02, 2012 04:55:29

However I got another similar problem (with a SVN version of psutil):

>>> psutil.phymem_usage()
__main__:1: DeprecationWarning: psutil.phymem_usage is deprecated
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/psutil/_common.py", line 101, in inner
    return fun(*args, **kwargs)
  File "/usr/lib/pymodules/python2.6/psutil/__init__.py", line 1063, in 
phymem_usage
    mem = virtual_memory()
  File "/usr/lib/pymodules/python2.6/psutil/__init__.py", line 946, in 
virtual_memory
    return _psplatform.virtual_memory()
  File "/usr/lib/pymodules/python2.6/psutil/_pslinux.py", line 139, in 
virtual_memory
    raise RuntimeError("line(s) not found")
RuntimeError: line(s) not found

@giampaolo
Copy link
Owner Author

From g.rodola on August 06, 2012 10:37:53

Heh... that's controversial as I'm not sure what's best to do: fill the missing 
fields with a null (0) value or let the exception propagate. 

> cat /proc/meminfo
> MemTotal:        4194304 kB
> MemFree:         3757852 kB
> SwapTotal:             0 kB
> SwapFree:              0 kB

Is this the whole file content produced on Debian Squeeze? If not can you paste 
the complete output?

@giampaolo
Copy link
Owner Author

From [email protected] on August 07, 2012 05:27:12

Yes, unfortunatelly it is. But I don't think it's a Debian issue, but an OpenVZ 
issue. It simply does not include all necessary info:

root@cdn-controller:~# uname -a
Linux cdn-controller.dev 2.6.32-5-openvz-amd64 #1 SMP Tue Jun 14 10:46:15 UTC 
2011 x86_64 GNU/Linux
root@cdn-controller:~# cat /proc/meminfo 
MemTotal:        4194304 kB
MemFree:         2943512 kB
SwapTotal:             0 kB
SwapFree:              0 kB
root@cdn-controller:~#

@giampaolo
Copy link
Owner Author

From g.rodola on August 09, 2012 02:11:52

I suppose that's not the only missing piece of information.
Have you tried to run tests?
I expect other failures due to file contents of /proc fs being incomplete or missing.
In that case I think we better off considering OpenVZ an unsupported platform.
I already have enough work on my hands with the other four *major* platforms 
(and another fifth one on the way =)).

@giampaolo
Copy link
Owner Author

From g.rodola on August 17, 2012 11:04:04

I modified both virtual_memory() and swap_memory() so that they no longer raise 
an exception in case of missing values not found in /proc fs.
Instead, the missing values are now set to 0 and a RuntimeWarning is raised.
Done in r1534 .

Status: FixedInSVN
Labels: OpSys-Linux Milestone-0.6.2

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 04:11:59

Updated csets after the SVN -> Mercurial migration: r266 == revision 
f910f2f333cc r1534 == revision 29c612ebf39d

@giampaolo
Copy link
Owner Author

From g.rodola on March 04, 2013 16:16:45

Labels: -Priority-Medium Priority-High

@giampaolo
Copy link
Owner Author

From g.rodola on April 07, 2013 18:21:49

Status: FixedInHG

@giampaolo
Copy link
Owner Author

From g.rodola on April 11, 2013 02:17:39

Labels: -Milestone-0.6.2 Milestone-0.7.0

@giampaolo
Copy link
Owner Author

From g.rodola on April 12, 2013 11:21:26

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant