I'm trying to use QTree and QTreeSemigroup in the algebird package but am unable to import them in the spark-shell.
I tried both:
spark-shell --jars ~/jars/algebird-core_2.10-0.1.11.jar
SPARK_CLASSPATH="~/jars/algebird-core_2.10-0.1.11.jar" spark-shell --jars ~/jars/algebird-core_2.10-0.1.11.jar
and I'm able to successfully import algebird like this:
import com.twitter.algebird._
But when I try to import Qtree I get that they are not members of the algebird package:
scala> import com.twitter.algebird.QTree
<console>:22: error: object QTree is not a member of package com.twitter.algebird
import com.twitter.algebird.QTree
^
scala> import com.twitter.algebird.QTreeSemigroup
<console>:22: error: object QTreeSemigroup is not a member of package com.twitter.algebird
import com.twitter.algebird.QTreeSemigroup
What gives?! Anyone seen this before?
Figured it out, I was using an old version of algebird. Works with the latest.
Related
I have installed yfinance, but when i try to import it, it gives me the error: cannot import name 'Mapping' from 'collections'. I tried writing on jupyter notebook from collections.abs import Mappings, but it didn't work. I tried to look at the file init.py, but there is no: from collection import mapping, there is only import _collections_abc, and from _collections import deque.
Please help if someone has a solution?My python version is 3.10.5
I have the following structure in my directory :
PROJECT
- classes
tunnelvisionlabs
postgresql
PostgreSqlLexer.class
PostgreSqlLexerAtnSimulator.class
PostgreSqlLexerUtils.class
- lib
antlr-4-7.jar
- BasicTest.java
In BasicTest.java, i have these imports:
package com.tunnelvisionlabs.postgresql.test;
import com.tunnelvisionlabs.postgresql.PostgreSqlLexer;
import com.tunnelvisionlabs.postgresql.PostgreSqlLexerUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Token;
import org.junit.Assert;
import org.junit.Test;
I try to compile with the following command :
javac -cp .:./lib/* BasicTests.java
I get these errors :
BasicTests.java:28: error: cannot find symbol
import com.tunnelvisionlabs.postgresql.PostgreSqlLexer;
^
symbol: class PostgreSqlLexer
location: package com.tunnelvisionlabs.postgresql
BasicTests.java:29: error: cannot find symbol
import com.tunnelvisionlabs.postgresql.PostgreSqlLexerUtils;
^
symbol: class PostgreSqlLexerUtils
location: package com.tunnelvisionlabs.postgresql
In the PostgreSqlLexer and PostgreSqlLexerUtils classes, i have this package declared at the beginning:
package com.tunnelvisionlabs.postgresql;
What do i need to do for my program to find these classes ? I tried adding the classes directory in lib and using the same command as before, so that the classpath also contains the classes directory, but it doesn't change anything.
If I read your project structure correctly, the source folder where BasicTest.java sits is at the same level as the lib folder. If so, then you can using the following javac classpath:
javac -cp .:lib/* BasicTests.java
^^^ lib/ is already where you are calling this
Review the following reference answer for more information:
Including all the jars in a directory within the Java classpath
I have a Scala file and I am using Play Framework 2.0.4 to compile it. Here is a part of it
import play.api.templates.Html;
import play.api.templates.Txt;
import securesocial.controllers.Registration.RegistrationInfo;
import securesocial.controllers.TemplatesPlugin.
import securesocial.core.{SecuredRequest, SocialUser};
import play.api.data.Form;
import securesocial.core.Identity;
import securesocial.core.SecureSocial._;
import securesocial.controllers.PasswordChange.ChangeInfo;
At compile time I get this error
identifier expected but 'import' found.
What is the issue here?
Could it be import securesocial.controllers.TemplatesPlugin.: the trailing dot?
Either remove the dot or make it import securesocial.controllers.TemplatesPlugin._
import org.apache.tomcat.util.http.fileupload.DiskFileUpload;
In my Eclipse said import org.apache.tomcat.util.http.fileupload.DiskFileUpload cannot resolved.
Even import jar commons-fileupload-1.2.2
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.apache.tomcat.util.http.fileupload.FileUpload;
import org.apache.tomcat.util.http.fileupload.FileUploadException;
But above three does"nt gives error..Why?
please check if you have coyote.jar or tomcat-coyote.jar in your classpath as this error is not a commons-fileupload-1.2.2.jar error.
Suppose I have such packages:
package test
package test.views
package test.others
package views
Now in a scala file, I want to import test._ and views._(not test.views._), so I write:
import test._
import views._
But when I use some classes under views._, it reports type xxx not found, unless I change views package to another name.
What should I do now?
You can switch package import order (theoretically it should work):
import views._
import test._
Or you can be more precise in views import:
import _root_.views._
Here's yet another way (though using _root_ is the surest way to go):
import test.{views => testviews, _}
import views._