Unable to import Actor from cell.actors - celery

from cell.actors import Actor
The above import produces an unresolved error in major IDEs like Pycharm.
Tried looking everywhere in the documentation of Celery/cell. The exact problem when ran in terminal looks as follows:
ImportError: cannot import name 'ipublish' from 'kombu.common'
As explained on their website, Cell is an actor framework for Kombu, a messaging library for Python.
I checked everywhere in source files cell/actors.py and kombu/common.py for the error and the files seemed to be correct and no error in code. Therefore, there must be some environmental mismatch problem.

Found a solution to the problem partially. Installing specifically python3.7.0 is making the unresolved reference errors go away in the IDE, but still unable to create Actor and import 'dAgent'. Looked into source files and 'dAgent' must have been changed to 'Agent' class.
Still, no resolution for this error, although importing these objects from source files and providing the same inputs solves the unresolved reference error. But, the main error from kombu still exists.

Related

Migrating to Dart 2 I get a "check imports error" that means that some templates have not been generated

I'm trying to migrate to Dart 2, I have a lot of packages and up to now I could do my job with not so much problems.
Now I'm getting a strange error bot with DDC and dart2js:
[SEVERE] build_web_compilers|entrypoint on web/main.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).
Please check the following imports:
`import 'package:ledger_web/src/ui/components/main_selection_bar.template.dart';` from ledger_web|lib/src/ui/components/service/main_selection_bar_service.dart at 7:1
`import 'package:ledger_web/src/ui/components/main_selection_bar.template.dart';` from ledger_web|lib/src/ui/components/service/main_selection_bar_service.template.dart at 11:1
... and more
It is correct to signal that there is not the import (MainSelectionBar is an angular component), because the template has not been generated.
Now the problem is, why the template is not there?
I checked the .dart_tool/build/generated directory but the template has not been created.
I have a similar package with a similar component that works fine, so I cannot figure out what's happened.
Is there a place where there is a more detailed error list?
Interestingly enough, there is also a case in which the template exists, but it is listed like if it was not found....
Any hint?
Most likely this is related to a build failure when generating the template, which is not being properly reported on subsequent builds. This pull request should help that https://github.com/dart-lang/build/pull/1834/, but you can also try running pub run build_runner clean and then doing a new build to get the original error back.

How to import libraries in Spark Notebook

I'm having trouble importing magellan-1.0.4-s_2.11 in spark notebook. I've downloaded the jar from https://spark-packages.org/package/harsha2010/magellan and have tried placing SPARK_HOME/bin/spark-shell --packages harsha2010:magellan:1.0.4-s_2.11 in the Start of Customized Settings section of the spark-notebook file of the bin folder.
Here are my imports
import magellan.{Point, Polygon, PolyLine}
import magellan.coord.NAD83
import org.apache.spark.sql.magellan.MagellanContext
import org.apache.spark.sql.magellan.dsl.expressions._
import org.apache.spark.sql.Row
import org.apache.spark.sql.types._
And my errors...
<console>:71: error: object Point is not a member of package org.apache.spark.sql.magellan
import magellan.{Point, Polygon, PolyLine}
^
<console>:72: error: object coord is not a member of package org.apache.spark.sql.magellan
import magellan.coord.NAD83
^
<console>:73: error: object MagellanContext is not a member of package org.apache.spark.sql.magellan
import org.apache.spark.sql.magellan.MagellanContext
I then tried to import the new library like any other library by placing it into the main script like so:
$lib_dir/magellan-1.0.4-s_2.11.jar"
This didn't work and I'm left scratching my head wondering what I've done wrong. How do I import libraries such as magellan into spark notebook?
Try evaluating something like
:dp "harsha2010" % "magellan" % "1.0.4-s_2.11"
It will load the library into Spark, allowing it to be imported - assuming it can be obtained though the Maven repo. In my case it failed with a message:
failed to load 'harsha2010:magellan:jar:1.0.4-s_2.11 (runtime)' from ["Maven2 local (file:/home/dev/.m2/repository/, releases+snapshots) without authentication", "maven-central (http://repo1.maven.org/maven2/, releases+snapshots) without authentication", "spark-packages (http://dl.bintray.com/spark-packages/maven/, releases+snapshots) without authentication", "oss-sonatype (https://oss.sonatype.org/content/repositories/releases/, releases+snapshots) without authentication"] into /tmp/spark-notebook/aether/b2c7d8c5-1f56-4460-ad39-24c4e93a9786
I think file was to big and connection was interrupted before whole file could be downloaded.
Workaround
So I downloaded the JAR manually from:
http://dl.bintray.com/spark-packages/maven/harsha2010/magellan/1.0.4-s_2.11/
and copied it into the:
/tmp/spark-notebook/aether/b2c7d8c5-1f56-4460-ad39-24c4e93a9786/harsha2010/magellan/1.0.4-s_2.11
And then :dp command worked. Try Calling it first, and if it will fail copy JAR into the right path to make things work.
Better solution
I should investigate why download failed to fix it in the first place... or put that library in my local M2 repo. But that should get you going.
I would suggest to check this:
https://github.com/spark-notebook/spark-notebook/blob/master/docs/metadata.md#import-download-dependencies
and
https://github.com/spark-notebook/spark-notebook/blob/master/docs/metadata.md#add-spark-packages
I think the :dp magic command is depreciated, instead you should add your custom dependencies in the notebook metadata. You can go in the menu Edit > Edit notebook metadata, there add something like:
"customDeps": [
"harsha2010 % magellan % 1.0.4-s_2.11"
]
Once done, you will need to restart the kernel, you can check in the browser console if the package is being downloaded properly.
The easy way, you should set or add the EXTRA_CLASSPATH environnent variable to point to your .jar file downloaded :
export EXTRA_CLASSPATH = </link/to/your.jar> or set EXTRA_CLASSPATH= </link/to/your.jar> in wondows OS. Here find the detailed solution.

Why does the scala-ide not allow multiple package definitions at the top of a file?

In scala it is common practice to stack package statements to allow shorter imports, but when I load a file using stacked packages into the scala ide and I attempt to use an import starting with the same organization I get a compiler error from what appears to be the presentation compiler. The code compiles fine in sbt outside of the IDE.
An example code snippet is as follows:
package com.coltfred
package util
package time
import com.github.nscala_time.time.Imports._
On the import I get the error object github is not a member of package com.coltfred.util.com.
If I move the import to a single line the error will go away, but we've used this practice frequently in our code base so changing them all to be single line package statements would be a pain.
Why is this happening and is there anything I can do to fix it?
Edit:
I used the eclipse-sbt plugin to generate the eclipse project file for this. The directory structure is what it should be and all of the dependencies are in the classpath.
Edit 2:
It turns out there was a file in the test tree of the util package (which should have been in the same package), but had a duplicate package statement at the top. I didn't check the test tree because it shouldn't affect the compilation of the main tree, but apparently I was wrong.
Not sure why the Scala IDE is not liking this, but you can force the import to start at the top level using _root_:
import _root_.com.github.nscala_time.time.Imports._
See if that avoids irritating the IDE.
This is a common annoyance that annoyed paulp into an attempt to fix it. His idea was that a dir that doesn't contribute class files shouldn't be taken as a package. If you can take util as scala.util, you should do so in preference to foo.util where that util is empty.
The util dir is the usual suspect, because who doesn't have a util dir lying around, and in particular, ./util?
apm#mara:~/tmp/coltfred$ mkdir -p com/coltfred/util/time
apm#mara:~/tmp/coltfred$ mkdir -p com/coltfred/util/com
apm#mara:~/tmp/coltfred$ vi com/coltfred/util/time/test.scala
apm#mara:~/tmp/coltfred$ scalac com/coltfred/util/time/test.scala
./com/coltfred/util/time/test.scala:5: error: object github is not a member of package com.coltfred.util.com
import com.github.nscala_time.time._
^
one error found
apm#mara:~/tmp/coltfred$ cat com/coltfred/util/time/test.scala
package com.coltfred
package util
package time
import com.github.nscala_time.time._
class Test
apm#mara:~/tmp/coltfred$
To debug, find out where the offending package is getting loaded from.

NestableException cannot be resolved when using apache.commons.configuration

Im using the following:
import java.util.Collections;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.configuration.XMLConfiguration;
and i get:
The type org.apache.commons.lang.exception.NestableException cannot be resolved. It is indirectly referenced from required .class files
Im using eclipse...
how can i resolve this? he offers me to Configure build path but i dont really know how to solve this collision from there.....
Problem solved...
had to download the commons-lang-2.4.jar and include in project.
couldnt be more simple than that....
Sounds like what is really needed is an update to the PropertiesConfiguration lib so that it gets along with latest lang lib. If its a "free" lib then it might not be coming, considering that its been years since last reply on this thread and this is still happening.
I have been having this issue as well, and have not found a way of resolving it apart from the aforementioned inclusion of both lang libs ... which does not seem to present any problems, though strict repository framework implementations (like Maven) might have problems with both libs included.
Had to remove commons-lang3-3.4 from my Java Build Path and added 2.6 , it solved the problem!

permanently hidden warning in scala application

I get the following warning whenever I start my Scala application:
WARN - imported `SVNProperties' is permanently hidden by definition of object SVNProperties in package core, at line 4 of app/core/SVNResource.scala
What could this mean?
You probably have code that looks something like this:
object Hidden {
import scala.collection.immutable
object immutable { def x = 7 }
}
except in a less obvious way. You're importing something--in my example, the package immutable--and then you go and define something else with the same name that prevents you from using what you imported.
In particular, it looks like you tried to import SVNProperties into SVNResource.scala, except that SVNResource.scala defines its own SVNProperties which hides the import.
I encountered this warning after moving some classes from one package to another. I guess there was some conflict between the new location and binaries from the old location. In my case this helped:
sbt clean
I got this warning when my class was importing classes in the same package.
Once I removed the unnecessary import, the warnings were removed.
This happened to me after moving a class from one package to another, like in astasiak's case. I ran sbt clean with no luck. For the life of me, I couldn't find the class in the old location.
However, I had other errors preventing me from building. When I fixed those, this error disappeared. My guess is that until you can build cleanly, sbt still thinks you have the class is in the old package, and includes this error with any other build errors that are preventing you from building.
My advice? Check for other compilation errors and fix those -- you might be erroneously getting this error due to sbt having an outdated view of your package structure since its last successful build.
Just to further expand on a comment posted by Nick, as this was the case for me:
Another common cause is that SVNProperties is in the same package and so is already in scope. Trying to import it explicitly results in this warning.
More concretely, you may have:
package app.core
// No need to import the following - it is already visible as
// you are in the same package
import app.core.SVNProperties
object SVNResource {
Use instead:
package app.core
object SVNResource {
(Opinion) As a matter of coding style you may want to camel case your variables differently like for eg. SvnProperties, SvnResource. It reads easier for most people, see also this question.
I had a main class with name Server and I was creating a jetty server in the main class in the following way.
import org.eclipse.jetty.server.Server
var server:Server=new Server()
I got the below warn on running sbt run
> [warn] /home/xxx/xxx/xxx/src/main/scala/com/xxx/xxx/main/Server.scala:3:
> imported `Server' is permanently hidden by definition of object Server in package main
[warn] import org.eclipse.jetty.server.Server
[warn] ^
[warn] one warning found
I renamed my main class and the warning disappeared.
If you are using Scala Eclipse IDE you can do :
Project > Clean...
After that all the warning will be removed.
Also, make sure the name of the package you import =/= object name.
I got this by having circular dependencies. Both my classes were using each other on accident.
If the warning comes from importing a class with the same name, you can always use import renaming.
package domain
case class Company (...
package models
import domain.{Company => _Company}
object Company extends SkinnyCRUDMapper[_Company] {
Issue is related to dependency conflict, When you have same class in multiple Jars compiler found one of class is hidden and gives an error.
check for your Jar version is same across project or try to change name/package for one of conflicted class