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

AttributeError: 'CDLL' object has no attribute 'getfunc' #794

Closed
lituan opened this issue Sep 14, 2015 · 3 comments
Closed

AttributeError: 'CDLL' object has no attribute 'getfunc' #794

lituan opened this issue Sep 14, 2015 · 3 comments

Comments

@lituan
Copy link

lituan commented Sep 14, 2015

I want to use pypy on windows, and i install virtualenv 13.0.1, then I try this command
virtualenv -p c:\zare\pypy-2.6.0-win32\pypy.exe pypy
but get error
Running virtualenv with interpreter c:\zare\pypy-2.6.0-win32\pypy.exe
AttributeError: 'CDLL' object has no attribute 'getfunc'
I do not know how to fix this

@lituan
Copy link
Author

lituan commented Dec 4, 2015

I fix this problem by removing previously installed python from the path

@mattip
Copy link
Contributor

mattip commented Nov 7, 2017

if another pypy is located on the path, virtualenv will pick up its libpypy-c.dll before the one from the -p arg.

IMO the fix is this:

--- a/virtualenv.py                                                                                       
+++ b/virtualenv.py                                                                                       
@@ -1248,16 +1248,24 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy  
                                                                                                          
             # we need to copy the DLL to enforce that windows will load the correct one.                 
             # may not exist if we are cygwin.                                                            
-            py_executable_dlls = [                                                                       
-                (                                                                                        
-                    'python%s.dll' % (sys.version_info[0]),                                              
-                    'python%s_d.dll' % (sys.version_info[0])                                             
-                ),                                                                                       
-                (                                                                                        
-                    'python%s%s.dll' % (sys.version_info[0], sys.version_info[1]),                       
-                    'python%s%s_d.dll' % (sys.version_info[0], sys.version_info[1])                      
-                )                                                                                        
-            ]                                                                                            
+            if is_pypy:                                                                                  
+                py_executable_dlls = [                                                                   
+                    (                                                                                    
+                        'libpypy-c.dll',                                                                 
+                        'libpypy_d-c.dll',                                                               
+                    ),                                                                                   
+                ]                                                                                        
+            else:                                                                                        
+                py_executable_dlls = [                                                                   
+                    (                                                                                    
+                        'python%s.dll' % (sys.version_info[0]),                                          
+                        'python%s_d.dll' % (sys.version_info[0])                                         
+                    ),                                                                                   
+                    (                                                                                    
+                        'python%s%s.dll' % (sys.version_info[0], sys.version_info[1]),                   
+                        'python%s%s_d.dll' % (sys.version_info[0], sys.version_info[1])                  
+                    )                                                                                    
+                ]                                                                                        
                                                                                                          
             for py_executable_dll, py_executable_dll_d in py_executable_dlls:                            
                 pythondll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)             

@mattip
Copy link
Contributor

mattip commented Dec 30, 2017

@lituan can you check that latest HEAD of virtualenv works, and if so close this?

@lituan lituan closed this as completed Jan 3, 2018
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants