I would rather use a lightweight text editor than eclipse (for a few reasons) but I can't seem to figure out how to import the junit JAR into my project without using eclipse. I don't know the java ecosystem very well, what is the best way of achieving this in either editor? or both? Thanks.
I tried putting the junit-4.12 JAR inside my java/jdk/lib/ext folder so that its in the build path of the java compiler, I read somewhere this works, though when I try the following imports I get the error:
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
TTester.java:6: error: package org.junit does not exist
import static org.junit.Assert.*;
^ TTester.java:10: error: package org.junit does not exist import org.junit.Before;
^TTester.java:11: error: package org.junit does not exist import org.junit.Test;
Using a text editor for a java application is going to be painful. You could look at some of these packages:
https://atom.io/packages/search?q=java
But I would recommend either Eclipse or IntelliJ Community edition - my personal preference is the latter. Java development beyond the most simple case really needs a full-blown IDE.
Related
I am trying to learn NLP using BERT. While trying to import bert model and tokenizer in colab. I am facing the below error.
ImportError: cannot import name '_LazyModule' from 'transformers.file_utils' (/usr/local/lib/python3.7/dist-packages/transformers/file_utils.py)
Here is my code
!pip install transformers==4.11.3
from transformers import BertModel, BertTokenizer
import torch
In order to fix the error.
I tried to upgrade both transformers and torch.
I have tried the solution from the below link:This
Still i am unable to go forward.
Please assist.
Based on these links 1, 2
This should help -
pip install 'lightning-flash[text]' --upgrade
Since the code provided by you is not the cause of the error as it runs on Colab when I tried it hence this might be the culprit in your environment
This is a toy version of a problem I have. I'm trying to use setuptools to compile some Cython code in place, as part of a larger project.
My topdir is test. It contains:
hello_world.pyx
def say_hi():
print('meh')
and setup.py
from setuptools import setup
from Cython.Build import cythonize
setup(
ext_modules=cythonize("hello.pyx"),
)
If I build these modules in place with python3 setup.py build_ext --inplace, everything works as expected.
But if add an empty __init__.py to my topdir, I get the following error:
copying build/lib.linux-x86_64-3.8/Code/test/hello.cpython-38-x86_64-linux-gnu.so -> Code/test
error: could not create 'Code/test/hello.cpython-38-x86_64-linux-gnu.so': No such file or directory
Why is this happening? And is there a standard way of fixing it? I would like for these compiled Cython modules to live alongside some other C/Python code which is still in development.
what is happening?
The complete description of what is happening can be found in this GitHub issue: https://github.com/pypa/setuptools/issues/3343#issuecomment-1143527672
TL;DR: When you add a __init__.py file in your top folder, it interferes with the way Cython computes the extension's name. This results in an incorrect name (incompatible with your project layout due to a missing folder) and causes setuptools to crash.
And is there a standard way of fixing it?
If you really want to keep the __init__.py file under your top-level project folder[^1], you can explicitly use Extension objects with the proper/correct name instead of relying on the automatic naming algorithm used by Cython:
from setuptools import Extension, setup
from Cython.Build import cythonize
extensions = [Extension("hello", ["hello.pyx"])]
setup(
ext_modules=cythonize(extensions),
)
[^1] Please note that this is not common practice in the Python packaging ecosystem.
I have created a node.js project, within which I have created a truffle directory and initialised its project. I have installed the openzeppelin (npm install #openzeppelin/contracts) library in this truffle project directory, but nothing appears to have been installed, although I did not received any error during the install process. The import statement in my project displays the error hereafter:
import "#openzeppelin/contracts/token/ERC721/ERC721Full.sol";
Source "#openzeppelin/contracts/token/ERC721/ERC721Full.sol" not found: File import callback not supported
It looks like they changed the name, and now the contract name is
ERC721.sol and not ERC721Full.sol, so try
import "#openzeppelin/contracts/token/ERC721/ERC721.sol";
Try this:
import "github.com/openzeppelin/contracts/token/ERC721/ERC721Full.sol"
I want to use chisel3.2, and have installed "sbt" into Mac OS-X.
I wrote my project (Scala file), and downloaded template of project.
I did;
sbt
It did a lint of "scala" but did not import chisel3 object.
Indeed this is caused by PATH setting, but there is no information about it.
Does anyone suggest a solution?
Can somebody please help me loading the ipython module into jupyter notebooks?
ipython is a dependency for Jupyter, so it's already installed.
It looks like you're trying to import ipython widgets (ipywidgets) for use in Jupyter. To do this, in your shell (outside of Jupyter) install ipywidgets:
pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension
Then import widgets:
import ipywidgets as widgets
Read the docs to learn more about installing and using ipython widgets.
I believe that part of the problem is the capitalisation of the IPython package in your import statement:
try: import IPython.html.widgets
I don't know if that will get you everything you want, but that's probably the issue regarding your import.