unable to install packages from pypi repository (pypi search return 500 with nullpointer exception)

1,108 views
Skip to first unread message

Csaba

unread,
Apr 15, 2017, 6:00:11 AM4/15/17
to Nexus Users
Hi guys,

I have installed nexus because of its compelling promise to host maven, npm and pypi repos in the same place.
However I have some issues with the pypi part. I am not sure what I miss here, therefore you're help would be greatly appreciated.

Problem with search:
Running "pip search project_name -i https://user:pass@fqdn/repository/my-python-repo/ -vvv"
I end up with: "HTTPError: 500 Server Error: javax.servlet.ServletException: java.lang.NullPointerException for url: https://fqdn/repository/my_python_repo/"

Problem with install:
Running "pip install flash -i https://user:pass@fqdn/repository/my-python-repo/ -vvv" brings also no success:
"
...
  Getting page https://user:password@fqdn/repository/my-python-repo/packages/project_name/
  No cache entry available
  "GET /repository/my-python-repo/packages/project_name/ HTTP/1.1" 404 None
  Status code 404 not in [200, 203, 300, 301]
  Could not fetch URL https://user:password@fqdn/repository/my-python-repo/packages/project_name/: 404 Client Error: Not Found for url: https://fqdn/repository/my-python-repo/packages/project_name/ - skipping
...
Could not find a version that satisfies the requirement project_name (from versions: )
"

Thanks again 
Cheers
Csaba

Background information:
Installed Nexus version: 3.2.0 and 3.3.0-01;
Using HTTPS offloading within an Nginx reverse proxy;
Hosted Pypi repo;
The repo is accessible only for authenticated users;

The artifact was uploaded by the command "twine upload -r my_repo_index dist/*", whereas the "my_repo_index" is defined in the ~/.pypirc 
==
[distutils]
index-servers=my_repo_index

[my_repo_index]
username = user_name
password = password
==

The path of the asset on Nexus is:
"packages/project_name/1.0.0rc1/project_name-1.0.0rc1-py2-none-any.whl"

====
The Null Pointer exception on the Nexus server (when using pip search):
"
2017-04-15 09:31:24,283+0000 WARN  [qtp76097005-42] tamas org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: POST /repository/my-python-repo/
java.lang.NullPointerException: null
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:770) [na:na]
at org.sonatype.nexus.repository.pypi.internal.HostedHandlers.extractPayloads(HostedHandlers.java:126) [na:na]
at org.sonatype.nexus.repository.pypi.internal.HostedHandlers.lambda$2(HostedHandlers.java:106) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.storage.UnitOfWorkHandler.handle(UnitOfWorkHandler.java:39) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.view.handlers.ContentHeadersHandler.handle(ContentHeadersHandler.java:44) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.view.handlers.ConditionalRequestHandler.handle(ConditionalRequestHandler.java:72) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at com.sonatype.nexus.plugins.healthcheck.downloads.AssetDownloadCountContributedHandler.handle(AssetDownloadCountContributedHandler.java:47) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.view.handlers.HandlerContributor.handle(HandlerContributor.java:67) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.view.handlers.ExceptionHandler.handle(ExceptionHandler.java:43) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:52) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.view.Context$proceed.call(Unknown Source) [na:na]
at org.sonatype.nexus.repository.pypi.internal.PyPiRecipeSupport$_closure1.doCall(PyPiRecipeSupport.groovy:94) [na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) [na:1.8.0_121]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [na:na]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [na:na]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) [na:na]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024) [na:na]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1089) [na:na]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024) [na:na]
at groovy.lang.Closure.call(Closure.java:414) [na:na]
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:54) [na:na]
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:124) [na:na]
at com.sun.proxy.$Proxy158.handle(Unknown Source) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:46) [na:na]
at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
at org.sonatype.nexus.repository.view.Context.start(Context.java:114) [na:na]
at org.sonatype.nexus.repository.view.Router.dispatch(Router.java:63) [na:na]
at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:52) [na:na]
at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:43) [na:na]
at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.dispatchAndSend(ViewServlet.java:198) [na:na]
at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.doService(ViewServlet.java:160) [na:na]
at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.service(ViewServlet.java:117) [na:na]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api:3.1.0]
at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286) [com.google.inject:4.1.0]
at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276) [com.google.inject:4.1.0]
at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181) [com.google.inject:4.1.0]
at com.google.inject.servlet.DynamicServletPipeline.service(DynamicServletPipeline.java:71) [com.google.inject:4.1.0]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85) [com.google.inject:4.1.0]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:112) [org.apache.shiro.web:1.3.2]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [org.apache.shiro.web:1.3.2]
at org.sonatype.nexus.security.SecurityFilter.executeChain(SecurityFilter.java:85) [org.sonatype.nexus.security:3.3.0.01]
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [org.apache.shiro.web:1.3.2]
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [org.apache.shiro.core:1.3.2]
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [org.apache.shiro.core:1.3.2]
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [org.apache.shiro.core:1.3.2]
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [org.apache.shiro.web:1.3.2]
at org.sonatype.nexus.security.SecurityFilter.doFilterInternal(SecurityFilter.java:101) [org.sonatype.nexus.security:3.3.0.01]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [org.apache.shiro.web:1.3.2]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at org.sonatype.nexus.repository.httpbridge.internal.ExhaustRequestFilter.doFilter(ExhaustRequestFilter.java:71) [org.sonatype.nexus.plugins.nexus-repository-httpbridge:3.3.0.01]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at com.sonatype.nexus.licensing.internal.LicensingRedirectFilter.doFilter(LicensingRedirectFilter.java:112) [com.sonatype.nexus.plugins.nexus-licensing-plugin:3.3.0.01]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:97) [com.codahale.metrics.servlet:3.0.2]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at org.sonatype.nexus.internal.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:68) [org.sonatype.nexus.base:3.3.0.01]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at org.sonatype.nexus.internal.web.EnvironmentFilter.doFilter(EnvironmentFilter.java:102) [org.sonatype.nexus.base:3.3.0.01]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at org.sonatype.nexus.internal.web.HeaderPatternFilter.doFilter(HeaderPatternFilter.java:98) [org.sonatype.nexus.base:3.3.0.01]
at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) [com.google.inject:4.1.0]
at com.google.inject.servlet.DynamicFilterPipeline.dispatch(DynamicFilterPipeline.java:104) [com.google.inject:4.1.0]
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135) [com.google.inject:4.1.0]
at org.sonatype.nexus.bootstrap.osgi.DelegatingFilter.doFilter(DelegatingFilter.java:73) [org.sonatype.nexus.bootstrap:3.3.0.01]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668) [org.eclipse.jetty.servlet:9.3.7.v20160115]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581) [org.eclipse.jetty.servlet:9.3.7.v20160115]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [org.eclipse.jetty.security:9.3.7.v20160115]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) [org.eclipse.jetty.servlet:9.3.7.v20160115]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) [org.eclipse.jetty.server:9.3.7.v20160115]
at com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:175) [com.codahale.metrics.jetty9:3.0.2]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.Server.handle(Server.java:517) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) [org.eclipse.jetty.server:9.3.7.v20160115]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) [org.eclipse.jetty.io:9.3.7.v20160115]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) [org.eclipse.jetty.io:9.3.7.v20160115]
at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) [org.eclipse.jetty.io:9.3.7.v20160115]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) [org.eclipse.jetty.util:9.3.7.v20160115]
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) [org.eclipse.jetty.util:9.3.7.v20160115]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) [org.eclipse.jetty.util:9.3.7.v20160115]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) [org.eclipse.jetty.util:9.3.7.v20160115]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

"

Frederick Milens

unread,
Apr 16, 2017, 10:46:04 PM4/16/17
to Csaba, Nexus Users
Hello! Thanks for considering Nexus.

For search, your command should probably look something more like this (note the addition of /pypi and the lack of a trailing slash):

pip search project_name -i https://user:pass@fqdn/repository/my-python-repo/pypi -vvv

For install, your command should probably look something more like this (note the addition of /simple and the lack of a trailing slash here as well):

pip install flash -i https://user:pass@fqdn/repository/my-python-repo/simple -vvv

Using the wrong urls can be a confusing and time-consuming matter, so I'd recommend you also take a look at our user documentation regarding PyPI and Nexus, particularly the parts about configuring pip to work with Nexus (though reviewing the entire chapter might be a good idea):


In that documentation, you'll find essentially the same information as above, as far as the index and index-url settings and how they point to different urls within a repository. Basically what you're running into is that there's the simple url from which the various packages' indexes are resolved, and there's also the pypi url that exposes the XML RPC endpoint that handles search. It's not really any different for those operations than for the main PyPI site except that you have to configure each of them manually since the defaults no longer hold.

Either way, try the above changes and see what happens. We'd be very interested in hearing if that works or not in your case.

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/b1458194-365e-441f-8e32-89d61f12413d%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
Reply all
Reply to author
Forward
0 new messages