pip install -e后导入错误

时间:2017-10-01 20:56:02

标签: python pip conda

我从github克隆了一个repo(visdom)以便做出一些贡献。为了测试我的贡献,我尝试在conda env中安装模块:

/usr/lib/jvm/java-8-oracle/bin/java -XX:+TieredCompilation -
XX:TieredStopAtLevel=1 -XX:CICompilerCount=3 -Dfile.encoding=UTF-8 -
classpath /home/nischit/.gradle/caches/modules-2/files-
2.1/org.grails/grails-
shell/3.2.10/c6b000bbb8ac369a9be062f08e8a0a8d3f85705/grails-shell-            
3.2.10.jar:/home/nischit/.gradle/caches/modules-2/files-
2.1/org.slf4j/slf4j-
simple/1.7.25/8dacf9514f0c707cbbcdd6fd699e8940d42fb54e/slf4j-simple-
1.7.25.jar:/home/nischit/.gradle/caches/modules-2/files-
2.1/org.codehaus.plexus/plexus-component-api/1.0-alpha-
33/7d9560effcadf867937ac6885d0d1045ea98ab59/plexus-component-api-1.0-
alpha-33.jar:/home/nischit/.gradle/caches/modules-2/files


Running application...
2017-10-02 01:42:14.120 ERROR --- [ost-startStop-1] 
o.s.b.c.embedded.tomcat.TomcatStarter    : Error starting Tomcat 
context. Exception: 
org.springframework.beans.factory.BeanCreationException. Message: 
Error creating bean with name 'grailsCacheFilter': Cannot create 
inner bean '(inner bean)#17d4fdc1' of type
[grails.plugin.cache.web.filter.
simple.MemoryPageFragmentCachingFilter] 
while setting bean property 'filter'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name '(inner bean)#17d4fdc1': Unsatisfied 
dependency expressed through method 'setUrlMappingsHandlerMapping' 
parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:388)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:375)
    at grails.boot.GrailsApp$run.call(Unknown Source)
    at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.
defaultCall(CallSiteArray.java:48)
Caused by: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'grailsCacheFilter': Cannot create 
inner bean '(inner bean)#17d4fdc1' of type 
[grails.plugin.cache.web.filter.simple.
MemoryPageFragmentCachingFilter] while setting bean property 
'filter'; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name '(inner bean)#17d4fdc1': Unsatisfied 
dependency expressed through method 'setUrlMappingsHandlerMapping' 
parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error c 
reating bean with name 'dataSourceUnproxied': Initialization of bean 
failed; nested exception is 
org.springframework.beans.TypeMismatchException: Failed to convert 
property value of type 'java.lang.String' to required type 'long' for 
property 'maxAge'; nested exception is 
java.lang.NumberFormatException: For input string: "10*60000"
at 
org.springframework.beans.factory.support.
BeanDefinitionValueResolver.resolveInnerBean
(BeanDefinitionValueResolver.java:313)
Caused by: 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name '(inner bean)#17d4fdc1': Unsatisfied 
dependency expressed through method 'setUrlMappingsHandlerMapping' 
parameter 0; nested exception is 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSourceUnproxied': Initialization of bean 
failed; nested exception is 
org.springframework.beans.TypeMismatchException: Failed to convert 
property value of type 'java.lang.String' to required type 'long' for 
property 'maxAge'; nested exception is 
java.lang.NumberFormatException: For input string: "10*60000"
at 
org.springframework.beans.factory.annotation.
AutowiredAnnotationBeanPostProcessor
$AutowiredMethodElement.inject
(AutowiredAnnotationBeanPostProcessor.java:667)
Caused by: 
org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'urlMappingsHandlerMapping': 
Unsatisfied dependency expressed through method 
'setWebRequestInterceptors' parameter 0; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'openSessionInViewInterceptor': Cannot 
resolve reference to bean 'hibernateDatastore' while setting bean 
property 'hibernateDatastore'; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'hibernateDatastore': Bean instantiation via 
constructor failed; nested exception is 
org.springframework.beans.BeanInstantiationException: Failed to 
instantiate [org.grails.orm.hibernate.HibernateDatastore]: 
Constructor threw exception; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSource': Cannot resolve reference to 
bean 'dataSourceLazy' while setting constructor argument; nested 
exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'dataSourceLazy': Cannot resolve 
reference to bean 'dataSourceUnproxied' while setting constructor 
argument; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 'dataSourceUnproxied': Initialization of bean 
failed; nested exception is 
org.springframework.beans.TypeMismatchException: Failed to convert 
property value of type 'java.lang.String' to required type 'long' for 
property 'maxAge'; nested exception is 
java.lang.NumberFormatException: For input string: "10*60000"

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with 
non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info 
or --debug option to get more log output.
| Error Failed to start server (Use --stacktrace to see the full 
trace)

运行$ which pip /home/jkarimi91/Apps/anaconda2/envs/visdom/bin/pip $ pip install -e . 表示模块已成功安装:

pip list

但是,当我尝试导入模块时,收到导入错误:

visdom (0.1.4, /home/jkarimi91/Projects/visdom)

2 个答案:

答案 0 :(得分:0)

您可以使用-t标记用于告诉pip将软件包安装到特定位置,但是,实际上似乎有open issue function stopTimer() { clearTimeout(itemTimer); clearTimeout(stopTimeout); } -t不一致各种其他旗帜(我刚刚确认了这个问题的回购)。通过使用git URL语法进行安装来解决此问题,例如: pip install git+git://github.com/facebookresearch/visdom.git@master#egg=visdom

答案 1 :(得分:0)

正如Jmills评论所指出的,路径/home/jkarimi91/Projects/不在我的python路径中。另外,正如@Jmills answer所述,目前使用-t似乎不是一个可行的选择。

要解决此问题,我执行了以下操作:

$ pip uninstall visdom
$ pip install .

每次我对代码进行更改时都需要重复此方法,但至少它可以正常工作。